Hello, I have an abstract class (Base) that looks as follows:
| @Entity | @Table(name="MyTable") | @Inheritance(strategy=InheritanceType.SINGLE_TABLE) | @DiscriminatorColumn(name="OVERRIDE_LEVEL") | | class abstract Base { | some properties here | .. | .. | } | Then I have two classes that inherit from this base class that looks like: | @Entity | @DiscriminatorValue("Y_INSTANCE") | public class YBase extends Baseimplements Serializable { | ... | } | and another one as: | @Entity | @DiscriminatorValue("Z_INSTANCE") | public class ZBase extends Baseimplements Serializable { | | private SomeEntity someEntity; | | setter... | | @ManyToOne(optional=false) | @JoinColumn(name="SOME_ENTITY_ID", nullable=false, unique=false) | public SomeEntity getSomeEntity() { | return someEntity; | } | | } | With Mysql, When I persist YBase entities, everything work fine, and I see under the 'SOME_ENTITY_ID' column a value '0', I assume hibernate set a default value as 0 automatically although the column definition in msql is set as 'NOT_NULL' without a default value. In oracle, I get an exception as follows: Caused by: java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("IDM_PREPRD_REPOSITORY"."MY_TABLE"."SOME_ENTITY_ID") and in the database I can see that the column is set as NOT NULL, but a default value is not set when persisting YBASE entities which has no relationship with the SomeEntity entity, Any idea? there's a way to fix this issue except annotating the 'getSomeEntity' as optional? thanks, Asaf. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073905#4073905 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073905 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user