问题
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.
回答1:
There is no standard support for object-types in JPA.
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.
来源:https://stackoverflow.com/questions/14600155/oracle-database-object-type-import-in-java