Java中的Oracle数据库对象类型导入 [英] Oracle database object type import in Java
问题描述
是否有一种方法可以在Java(JPA)中导入oracle定义的对象类型.我在数据库中定义了一个复杂的对象:
Is there a way to import oracle defined object type in Java(JPA). I have a complex object defined in database :
create or replace TYPE "myType"{
someString varchar2(100),
someString2 varchar2(100),
constructor....}
该对象类型比在数据库表中使用的类型.
this object type is than used in a database table.
推荐答案
JPA中没有对对象类型的标准支持.
There is no standard support for object-types in JPA.
如果使用的是EclipseLink,则可以使用@Struct批注来映射对象类型,
If you are using EclipseLink, you can use the @Struct annotation to map object-types,
http://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/a_struct.htm#CBBDCAHG
如果您映射了一个类型的表,并且该类型没有嵌套的类型,那么它将看起来像一个普通的关系表,并且您可以像一个普通的关系表一样进行映射.
If you are mapped a table of the type, and the type has no nested types, then it will just look like a normal relational table, and you can just map in like a normal relational table.
这篇关于Java中的Oracle数据库对象类型导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!