Oracle database object type import in Java

不打扰是莪最后的温柔 提交于 2020-01-25 07:15:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!