基于Java对象创建JPA 映射:Java2JPA
jopen
12年前
Java2JPA 是一个 Java 类库,能够很方便的基于 Java 对象来创建 JPA 映射。
示例代码:
Java2JpaMappingGenerator java2JpaMappingGenerator = new Java2JpaMappingGenerator(); java2JpaMappingGenerator.setRenderJpaMappingForClassStrategy( new RenderJpaMappingForClassStrategyDefaultImpl()); JpaMappingRendererDefaultImpl jpaMappingRenderer = new JpaMappingRendererDefaultImpl("target/META-INF/orm.xml"); java2JpaMappingGenerator.setJpaMappingRenderer(jpaMappingRenderer); java2JpaMappingGenerator.generateJpaMappingsForPackages("com.test.model"); jpaMappingRenderer.createMappedFiles();