Hibernate version: 3.2.6.ga
Hibernate annotations version: 3.3.0.ga
Database: Oracle 10g Express Edition
I have a bidirectional @OneToOne with the foreign key in an entity that is part of an inheritance hierarchy. This works with inheritance strategy JOINED but for other reasons I need to make the strategy SINGLE_TABLE and use SecondaryTables as suggested in "Java Persistence With Hibernate" section 5.1.5.
When I make this change I get an exception
Quote:
org.hibernate.PropertyValueException: not-null property references a null or transient value
This relates to the reference from the entity at the "mappedBy" end of the association to the entity with the foreign key.
If I look in the debugger I see the following differences when using SINGLE_TABLE and SecondaryColumns. One difference is that the types entry is showing as a ManyToOneType (org.hibernate.type.ManyToOneType(hib.example.MessageType1), whereas with JOINED strategy it is OneToOneType. Another is that the propertyNullability is showing as false, whereas with JOINED strategy it is true.
I have several questions.....
Is this intentional behaviour or a bug?
If intentional what semantics is it enforcing?
What are the implications for using secondary tables to achieve a mixture of inheritance strategies (the so-called <join> trick)?
Here are sample classes to reproduce this:
The root of the inheritance hierarchy
Code:
package hib.example;
import ....
/**
* The base class for messages.
*/
@Entity
@Inheritance( strategy = InheritanceType.SINGLE_TABLE)
@Table(name = "example_mess")
@DiscriminatorColumn(name="msg_Type")
public abstract class Message {
@Id
@GeneratedValue(generator="Oid")
@GenericGenerator(name = "Oid",
strategy = "hib.example.OidGenerator")
public long oid;
}
The subclass entity containing the @OneToOneCode:
package hib.example;
imports....
/**
* A particular type of {@link Message}, which relates to a {@link BusinessThing}.
*/
@Entity
@SecondaryTables({@SecondaryTable(name = "example_mt1")})
@DiscriminatorValue("MT564")
public class MessageType1 extends Message {
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "bus_thing_oid", table="example_mt1")
public BusinessThing businessThing;
}
The other end of the @OneToOne Code:
package hib.example;
imports...
@Entity
@Table(name = "example_bus_thing")
public class BusinessThing {
@Id
@GeneratedValue(generator="Oid")
@GenericGenerator(name = "Oid",
strategy = "hib.example.OidGenerator")
public long oid;
@OneToOne(mappedBy = "businessThing")
MessageType1 message;
}
The code to persist.... Code:
MessageType1 mt1 = new MessageType1();
BusinessThing bt = new BusinessThing();
bt.message = mt1;
mt1.businessThing = bt;
sess.persist(mt1);
Full stack trace of any exception that occurs:Code:
Exception in thread "main" org.hibernate.PropertyValueException: not-null property references a null or transient value: hib.example.BusinessThing.message
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:609)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:601)
at org.hibernate.engine.CascadingAction$8.cascade(CascadingAction.java:295)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:431)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at hib.example.MessageType1.main(MessageType1.java:42)
Debug level Hibernate log excerpt:Code:
INFO - Hibernate Annotations 3.3.0.GA
INFO - Hibernate 3.2.6
INFO - hibernate.properties not found
INFO - Bytecode provider name : cglib
INFO - using JDK 1.4 java.sql.Timestamp handling
DEBUG - Validator not present in classpath, ignoring event listener registration
DEBUG - Search not present in classpath, ignoring event listener registration
DEBUG - Preparing to build session factory with filters : {}
DEBUG - Execute first pass mapping processing
DEBUG - Process hbm files
DEBUG - Process annotated classes
INFO - Binding entity from annotated class: hib.example.Message
DEBUG - Binding column msg_Type unique false
DEBUG - Import with entity name=Message
INFO - Bind entity hib.example.Message on table example_mess
DEBUG - Setting discriminator for entity hib.example.Message
DEBUG - Processing hib.example.Message property annotation
DEBUG - Processing hib.example.Message field annotation
DEBUG - Processing annotations of hib.example.Message.oid
DEBUG - Binding column oid unique false
DEBUG - oid is an id
DEBUG - Add generic generator with name: Oid
DEBUG - building SimpleValue for oid
DEBUG - Building property oid
DEBUG - Cascading oid with null
DEBUG - Bind @Id on oid
INFO - Binding entity from annotated class: hib.example.MessageType1
DEBUG - Import with entity name=MessageType1
INFO - Adding secondary table to entity hib.example.MessageType1 -> example_mt1
DEBUG - Processing hib.example.MessageType1 field annotation
DEBUG - Processing annotations of hib.example.MessageType1.businessThing
DEBUG - Binding column bus_thing_oid unique false
DEBUG - Binding column businessThing unique false
DEBUG - Fetching businessThing with JOIN
DEBUG - Building property businessThing
DEBUG - Cascading businessThing with all
DEBUG - Binding column oid unique false
INFO - Binding entity from annotated class: hib.example.BusinessThing
DEBUG - Binding column DTYPE unique false
DEBUG - Import with entity name=BusinessThing
INFO - Bind entity hib.example.BusinessThing on table example_bus_thing
DEBUG - Processing hib.example.BusinessThing property annotation
DEBUG - Processing hib.example.BusinessThing field annotation
DEBUG - Processing annotations of hib.example.BusinessThing.oid
DEBUG - Binding column oid unique false
DEBUG - oid is an id
DEBUG - Add generic generator with name: Oid
DEBUG - building SimpleValue for oid
DEBUG - Building property oid
DEBUG - Cascading oid with null
DEBUG - Bind @Id on oid
DEBUG - Processing annotations of hib.example.BusinessThing.message
DEBUG - Binding column null unique false
DEBUG - Binding column message unique false
DEBUG - Fetching message with JOIN
DEBUG - processing manytoone fk mappings
DEBUG - processing extends queue
DEBUG - processing collection mappings
DEBUG - Building property message
DEBUG - Cascading message with none
DEBUG - processing native query and ResultSetMapping mappings
DEBUG - processing association property references
DEBUG - processing foreign key constraints
DEBUG - resolving reference to class: hib.example.MessageType1
DEBUG - resolving reference to class: hib.example.BusinessThing
INFO - Hibernate Validator not found: ignoring
WARN - No connection properties specified - the user must supply JDBC connections
INFO - Using dialect: org.hibernate.dialect.Oracle9Dialect
WARN - The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead
INFO - Using default transaction strategy (direct JDBC transactions)
INFO - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
INFO - Automatic flush during beforeCompletion(): disabled
INFO - Automatic session close at end of transaction: disabled
INFO - Scrollable result sets: disabled
DEBUG - Wrap result sets: disabled
INFO - JDBC3 getGeneratedKeys(): disabled
INFO - Connection release mode: auto
INFO - Default batch fetch size: 1
INFO - Generate SQL with comments: disabled
INFO - Order SQL updates by primary key: disabled
INFO - Order SQL inserts for batching: disabled
INFO - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO - Using ASTQueryTranslatorFactory
INFO - Query language substitutions: {}
INFO - JPA-QL strict compliance: disabled
INFO - Second-level cache: enabled
INFO - Query cache: disabled
INFO - Cache provider: org.hibernate.cache.NoCacheProvider
INFO - Optimize cache for minimal puts: disabled
INFO - Structured second-level cache entries: disabled
DEBUG - Using dialect defined converter
INFO - Statistics: disabled
INFO - Deleted entity synthetic identifier rollback: disabled
INFO - Default entity-mode: pojo
INFO - Named query checking : enabled
INFO - building session factory
DEBUG - Session factory constructed with filter configurations : {}
DEBUG - instantiating session factory with properties: {java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=C:\Java\jdk1.6.0_03\jre\bin, java.vm.version=1.6.0_03-b05, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=GB, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\trafic2dev\trafic, java.runtime.version=1.6.0_03-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Java\jdk1.6.0_03\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\Users\peteg\AppData\Local\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows Vista, sun.jnu.encoding=Cp1252, java.library.path=C:\Java\jdk1.6.0_03\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files\Wave Systems Corp\Dell Preboot Manager\Access Client\v5\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\cvsnt;C:\tcl\bin;C:\cygwin\bin;C:\Java\jdk1.6.0_03\bin;C:\maven-2\bin;C:\Program Files\QuickTime\QTSystem\, java.specification.name=Java Platform API Specification, java.class.version=50.0, sun.management.compiler=HotSpot Client Compiler, os.version=6.0, user.home=C:\Users\peteg, user.timezone=Europe/London, jdbc.drivers=oracle.jdbc.driver.OracleDriver, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=windows-1252, java.specification.version=1.6, user.name=peteg, java.class.path=C:\Java\jdk1.6.0_03\jre\lib\charsets.jar;C:\Java\jdk1.6.0_03\jre\lib\deploy.jar;C:\Java\jdk1.6.0_03\jre\lib\javaws.jar;C:\Java\jdk1.6.0_03\jre\lib\jce.jar;C:\Java\jdk1.6.0_03\jre\lib\jsse.jar;C:\Java\jdk1.6.0_03\jre\lib\management-agent.jar;C:\Java\jdk1.6.0_03\jre\lib\plugin.jar;C:\Java\jdk1.6.0_03\jre\lib\resources.jar;C:\Java\jdk1.6.0_03\jre\lib\rt.jar;C:\Java\jdk1.6.0_03\jre\lib\ext\dnsns.jar;C:\Java\jdk1.6.0_03\jre\lib\ext\localedata.jar;C:\Java\jdk1.6.0_03\jre\lib\ext\sunjce_provider.jar;C:\Java\jdk1.6.0_03\jre\lib\ext\sunmscapi.jar;C:\Java\jdk1.6.0_03\jre\lib\ext\sunpkcs11.jar;C:\trafic2dev\trafic\trafic-server-common\target\classes;C:\maven-repository\com\oracle\ojdbc14\10.2.0.2.0\ojdbc14-10.2.0.2.0.jar;C:\trafic2dev\trafic\trafic-common\target\classes;C:\trandevnew\trace-common\target\classes;C:\maven-repository\junit\junit\3.8.1\junit-3.8.1.jar;C:\maven-repository\org\incava\java-diff\1.0.5\java-diff-1.0.5.jar;C:\maven-repository\log4j\log4j\1.2.13\log4j-1.2.13.jar;C:\maven-repository\com\tracegroup\trace-common\1.1-SNAPSHOT\trace-common-1.1-SNAPSHOT.jar;C:\maven-repository\junit\junit\4.4\junit-4.4.jar;C:\maven-repository\com\tracegroup\trafic\trafic-liquibase\0.1-SNAPSHOT\trafic-liquibase-0.1-SNAPSHOT.jar;C:\maven-repository\easymock\easymock\1.2_Java1.3\easymock-1.2_Java1.3.jar;C:\maven-repository\javax\persistence\persistence-api\1.0\persistence-api-1.0.jar;C:\maven-repository\net\sourceforge\jtds\jtds\1.2.2\jtds-1.2.2.jar;C:\maven-repository\org\liquibase\liquibase-core\1.4.1\liquibase-core-1.4.1.jar;C:\dev\hibernate-annotations-3.3.0.GA\lib\ejb3-persistence.jar;C:\dev\hibernate-3.2\lib\concurrent-1.3.2.jar;C:\dev\hibernate-3.2\lib\log4j-1.2.11.jar;C:\dev\hibernate-3.2\lib\ant-1.6.5.jar;C:\dev\hibernate-3.2\lib\junit-3.8.1.jar;C:\dev\hibernate-3.2\lib\swarmcache-1.0rc2.jar;C:\dev\hibernate-3.2\lib\c3p0-0.9.1.jar;C:\dev\hibernate-3.2\lib;C:\dev\hibernate-3.2\lib\jboss-system.jar;C:\dev\hibernate-3.2\lib\jaxen-1.1-beta-7.jar;C:\dev\hibernate-3.2\lib\checkstyle-all.jar;C:\dev\hibernate-3.2\lib\asm-attrs.jar;C:\dev\hibernate-3.2\lib\jta.jar;C:\dev\hibernate-annotations-3.3.0.GA\hibernate-annotations.jar;C:\dev\hibernate-3.2\lib\jboss-jmx.jar;C:\dev\hibernate-3.2\lib\commons-logging-1.0.4.jar;C:\dev\hibernate-3.2\lib\syndiag2.jar;C:\dev\hibernate-3.2\lib\cglib-2.1.3.jar;C:\dev\hibernate-3.2\lib\jacc-1_0-fr.jar;C:\dev\hibernate-3.2\lib\ant-swing-1.6.5.jar;C:\dev\hibernate-3.2\lib\jboss-cache.jar;C:\dev\hibernate-3.2\lib\jgroups-2.2.8.jar;C:\dev\hibernate-3.2\lib\antlr-2.7.6.jar;C:\dev\hibernate-annotations-3.3.0.GA\lib\hibernate-commons-annotations.jar;C:\dev\hibernate-3.2\lib\asm.jar;C:\dev\hibernate-3.2\lib\ant-antlr-1.6.5.jar;C:\dev\hibernate-3.2\lib\jaas.jar;C:\dev\hibernate-3.2\lib\cleanimports.jar;C:\dev\hibernate-3.2\lib\ant-junit-1.6.5.jar;C:\dev\hibernate-3.2\lib\xml-apis.jar;C:\dev\hibernate-3.2\lib\dom4j-1.6.1.jar;C:\dev\hibernate-3.2\lib\ehcache-1.2.3.jar;C:\dev\hibernate-3.2\lib\proxool-0.8.3.jar;C:\dev\hibernate-3.2\lib\versioncheck.jar;C:\dev\hibernate-3.2\lib\jboss-common.jar;C:\dev\hibernate-3.2\lib\oscache-2.1.jar;C:\dev\hibernate-3.2\lib\commons-collections-2.1.1.jar;C:\dev\hibernate-annotations-3.3.0.GA\lib;C:\dev\hibernate-3.2\hibernate3.jar;C:\dev\hibernate-3.2\lib\xerces-2.6.2.jar;C:\dev\hibernate-3.2\lib\ant-launcher-1.6.5.jar;C:\dev\hibernate-3.2\lib\javassist.jar;C:\Program Files\JetBrains\IntelliJ IDEA 7.0.2\lib\idea_rt.jar, hibernate.bytecode.use_reflection_optimizer=false, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=C:\Java\jdk1.6.0_03\jre, hibernate.dialect=org.hibernate.dialect.Oracle9Dialect, java.specification.vendor=Sun Microsystems Inc., user.language=en, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.6.0_03, java.ext.dirs=C:\Java\jdk1.6.0_03\jre\lib\ext;C:\Windows\Sun\Java\lib\ext, sun.boot.class.path=C:\Java\jdk1.6.0_03\jre\lib\resources.jar;C:\Java\jdk1.6.0_03\jre\lib\rt.jar;C:\Java\jdk1.6.0_03\jre\lib\sunrsasign.jar;C:\Java\jdk1.6.0_03\jre\lib\jsse.jar;C:\Java\jdk1.6.0_03\jre\lib\jce.jar;C:\Java\jdk1.6.0_03\jre\lib\charsets.jar;C:\Java\jdk1.6.0_03\jre\classes, java.vendor=Sun Microsystems Inc., file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, sun.desktop=windows, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86}
DEBUG - Static SQL for entity: hib.example.Message
DEBUG - Version select: select oid from example_mess where oid =?
DEBUG - Snapshot select: select message_.oid from example_mess message_ where message_.oid=?
DEBUG - Insert 0: insert into example_mess (msg_Type, oid) values ('Message', ?)
DEBUG - Update 0: null
DEBUG - Delete 0: delete from example_mess where oid=?
DEBUG - Identity insert: insert into example_mess (msg_Type) values ('Message')
DEBUG - Static SQL for entity: hib.example.BusinessThing
DEBUG - Version select: select oid from example_bus_thing where oid =?
DEBUG - Snapshot select: select businessth_.oid, businessth_1_.oid as oid1_ from example_bus_thing businessth_ left outer join example_mt1 businessth_1_ on businessth_.oid=businessth_1_.bus_thing_oid where businessth_.oid=?
DEBUG - Insert 0: insert into example_bus_thing (oid) values (?)
DEBUG - Update 0: null
DEBUG - Delete 0: delete from example_bus_thing where oid=?
DEBUG - Insert 1: insert into example_mt1 (oid, bus_thing_oid) values (?, ?)
DEBUG - Update 1: update example_mt1 set oid=? where bus_thing_oid=?
DEBUG - Delete 1: delete from example_mt1 where bus_thing_oid=?
DEBUG - Identity insert: insert into example_bus_thing values ( )
DEBUG - Static SQL for entity: hib.example.MessageType1
DEBUG - Version select: select oid from example_mess where oid =?
DEBUG - Snapshot select: select messagetyp_.oid, messagetyp_1_.bus_thing_oid as bus2_1_ from example_mess messagetyp_ left outer join example_mt1 messagetyp_1_ on messagetyp_.oid=messagetyp_1_.oid where messagetyp_.oid=?
DEBUG - Insert 0: insert into example_mess (msg_Type, oid) values ('MT564', ?)
DEBUG - Update 0: null
DEBUG - Delete 0: delete from example_mess where oid=?
DEBUG - Insert 1: insert into example_mt1 (bus_thing_oid, oid) values (?, ?)
DEBUG - Update 1: update example_mt1 set bus_thing_oid=? where oid=?
DEBUG - Delete 1: delete from example_mt1 where oid=?
DEBUG - Identity insert: insert into example_mess (msg_Type) values ('MT564')
DEBUG - Static select for entity hib.example.Message: select message0_.oid as oid0_2_, message0_1_.bus_thing_oid as bus2_1_2_, message0_.msg_Type as msg1_0_2_, businessth1_.oid as oid2_0_, businessth1_1_.oid as oid1_0_, messagetyp2_.oid as oid0_1_, messagetyp2_1_.bus_thing_oid as bus2_1_1_ from example_mess message0_ left outer join example_mt1 message0_1_ on message0_.oid=message0_1_.oid left outer join example_bus_thing businessth1_ on message0_1_.bus_thing_oid=businessth1_.oid left outer join example_mt1 businessth1_1_ on businessth1_.oid=businessth1_1_.bus_thing_oid left outer join example_mess messagetyp2_ on businessth1_1_.oid=messagetyp2_.oid left outer join example_mt1 messagetyp2_1_ on messagetyp2_.oid=messagetyp2_1_.oid where message0_.oid=?
DEBUG - Static select for entity hib.example.Message: select message0_.oid as oid0_2_, message0_1_.bus_thing_oid as bus2_1_2_, message0_.msg_Type as msg1_0_2_, businessth1_.oid as oid2_0_, businessth1_1_.oid as oid1_0_, messagetyp2_.oid as oid0_1_, messagetyp2_1_.bus_thing_oid as bus2_1_1_ from example_mess message0_ left outer join example_mt1 message0_1_ on message0_.oid=message0_1_.oid left outer join example_bus_thing businessth1_ on message0_1_.bus_thing_oid=businessth1_.oid left outer join example_mt1 businessth1_1_ on businessth1_.oid=businessth1_1_.bus_thing_oid left outer join example_mess messagetyp2_ on businessth1_1_.oid=messagetyp2_.oid left outer join example_mt1 messagetyp2_1_ on messagetyp2_.oid=messagetyp2_1_.oid where message0_.oid=?
DEBUG - Static select for entity hib.example.Message: select message0_.oid as oid0_0_, message0_1_.bus_thing_oid as bus2_1_0_, message0_.msg_Type as msg1_0_0_ from example_mess message0_ left outer join example_mt1 message0_1_ on message0_.oid=message0_1_.oid where message0_.oid=? for update
DEBUG - Static select for entity hib.example.Message: select message0_.oid as oid0_0_, message0_1_.bus_thing_oid as bus2_1_0_, message0_.msg_Type as msg1_0_0_ from example_mess message0_ left outer join example_mt1 message0_1_ on message0_.oid=message0_1_.oid where message0_.oid=? for update nowait
DEBUG - Static select for entity hib.example.Message: select message0_.oid as oid0_0_, message0_1_.bus_thing_oid as bus2_1_0_, message0_.msg_Type as msg1_0_0_ from example_mess message0_ left outer join example_mt1 message0_1_ on message0_.oid=message0_1_.oid where message0_.oid=? for update nowait
DEBUG - Static select for action ACTION_MERGE on entity hib.example.Message: select message0_.oid as oid0_1_, message0_1_.bus_thing_oid as bus2_1_1_, message0_.msg_Type as msg1_0_1_, businessth1_.oid as oid2_0_, businessth1_1_.oid as oid1_0_ from example_mess message0_ left outer join example_mt1 message0_1_ on message0_.oid=message0_1_.oid left outer join example_bus_thing businessth1_ on message0_1_.bus_thing_oid=businessth1_.oid left outer join example_mt1 businessth1_1_ on businessth1_.oid=businessth1_1_.bus_thing_oid where message0_.oid=?
DEBUG - Static select for action ACTION_REFRESH on entity hib.example.Message: select message0_.oid as oid0_1_, message0_1_.bus_thing_oid as bus2_1_1_, message0_.msg_Type as msg1_0_1_, businessth1_.oid as oid2_0_, businessth1_1_.oid as oid1_0_ from example_mess message0_ left outer join example_mt1 message0_1_ on message0_.oid=message0_1_.oid left outer join example_bus_thing businessth1_ on message0_1_.bus_thing_oid=businessth1_.oid left outer join example_mt1 businessth1_1_ on businessth1_.oid=businessth1_1_.bus_thing_oid where message0_.oid=?
DEBUG - Static select for entity hib.example.BusinessThing: select businessth0_.oid as oid2_2_, businessth0_1_.oid as oid1_2_, messagetyp1_.oid as oid0_0_, messagetyp1_1_.bus_thing_oid as bus2_1_0_, businessth2_.oid as oid2_1_, businessth2_1_.oid as oid1_1_ from example_bus_thing businessth0_ left outer join example_mt1 businessth0_1_ on businessth0_.oid=businessth0_1_.bus_thing_oid inner join example_mess messagetyp1_ on businessth0_1_.oid=messagetyp1_.oid left outer join example_mt1 messagetyp1_1_ on messagetyp1_.oid=messagetyp1_1_.oid left outer join example_bus_thing businessth2_ on messagetyp1_1_.bus_thing_oid=businessth2_.oid left outer join example_mt1 businessth2_1_ on businessth2_.oid=businessth2_1_.bus_thing_oid where businessth0_.oid=?
DEBUG - Static select for entity hib.example.BusinessThing: select businessth0_.oid as oid2_2_, businessth0_1_.oid as oid1_2_, messagetyp1_.oid as oid0_0_, messagetyp1_1_.bus_thing_oid as bus2_1_0_, businessth2_.oid as oid2_1_, businessth2_1_.oid as oid1_1_ from example_bus_thing businessth0_ left outer join example_mt1 businessth0_1_ on businessth0_.oid=businessth0_1_.bus_thing_oid inner join example_mess messagetyp1_ on businessth0_1_.oid=messagetyp1_.oid left outer join example_mt1 messagetyp1_1_ on messagetyp1_.oid=messagetyp1_1_.oid left outer join example_bus_thing businessth2_ on messagetyp1_1_.bus_thing_oid=businessth2_.oid left outer join example_mt1 businessth2_1_ on businessth2_.oid=businessth2_1_.bus_thing_oid where businessth0_.oid=?
DEBUG - Static select for entity hib.example.BusinessThing: select businessth0_.oid as oid2_0_, businessth0_1_.oid as oid1_0_ from example_bus_thing businessth0_ left outer join example_mt1 businessth0_1_ on businessth0_.oid=businessth0_1_.bus_thing_oid where businessth0_.oid=? for update
DEBUG - Static select for entity hib.example.BusinessThing: select businessth0_.oid as oid2_0_, businessth0_1_.oid as oid1_0_ from example_bus_thing businessth0_ left outer join example_mt1 businessth0_1_ on businessth0_.oid=businessth0_1_.bus_thing_oid where businessth0_.oid=? for update nowait
DEBUG - Static select for entity hib.example.BusinessThing: select businessth0_.oid as oid2_0_, businessth0_1_.oid as oid1_0_ from example_bus_thing businessth0_ left outer join example_mt1 businessth0_1_ on businessth0_.oid=businessth0_1_.bus_thing_oid where businessth0_.oid=? for update nowait
DEBUG - Static select for action ACTION_MERGE on entity hib.example.BusinessThing: select businessth0_.oid as oid2_0_, businessth0_1_.oid as oid1_0_ from example_bus_thing businessth0_ left outer join example_mt1 businessth0_1_ on businessth0_.oid=businessth0_1_.bus_thing_oid where businessth0_.oid=?
DEBUG - Static select for action ACTION_REFRESH on entity hib.example.BusinessThing: select businessth0_.oid as oid2_0_, businessth0_1_.oid as oid1_0_ from example_bus_thing businessth0_ left outer join example_mt1 businessth0_1_ on businessth0_.oid=businessth0_1_.bus_thing_oid where businessth0_.oid=?
DEBUG - Static select for entity hib.example.MessageType1: select messagetyp0_.oid as oid0_2_, messagetyp0_1_.bus_thing_oid as bus2_1_2_, businessth1_.oid as oid2_0_, businessth1_1_.oid as oid1_0_, messagetyp2_.oid as oid0_1_, messagetyp2_1_.bus_thing_oid as bus2_1_1_ from example_mess messagetyp0_ left outer join example_mt1 messagetyp0_1_ on messagetyp0_.oid=messagetyp0_1_.oid left outer join example_bus_thing businessth1_ on messagetyp0_1_.bus_thing_oid=businessth1_.oid left outer join example_mt1 businessth1_1_ on businessth1_.oid=businessth1_1_.bus_thing_oid left outer join example_mess messagetyp2_ on businessth1_1_.oid=messagetyp2_.oid left outer join example_mt1 messagetyp2_1_ on messagetyp2_.oid=messagetyp2_1_.oid where messagetyp0_.oid=? and messagetyp0_.msg_Type='MT564'
DEBUG - Static select for entity hib.example.MessageType1: select messagetyp0_.oid as oid0_2_, messagetyp0_1_.bus_thing_oid as bus2_1_2_, businessth1_.oid as oid2_0_, businessth1_1_.oid as oid1_0_, messagetyp2_.oid as oid0_1_, messagetyp2_1_.bus_thing_oid as bus2_1_1_ from example_mess messagetyp0_ left outer join example_mt1 messagetyp0_1_ on messagetyp0_.oid=messagetyp0_1_.oid left outer join example_bus_thing businessth1_ on messagetyp0_1_.bus_thing_oid=businessth1_.oid left outer join example_mt1 businessth1_1_ on businessth1_.oid=businessth1_1_.bus_thing_oid left outer join example_mess messagetyp2_ on businessth1_1_.oid=messagetyp2_.oid left outer join example_mt1 messagetyp2_1_ on messagetyp2_.oid=messagetyp2_1_.oid where messagetyp0_.oid=? and messagetyp0_.msg_Type='MT564'
DEBUG - Static select for entity hib.example.MessageType1: select messagetyp0_.oid as oid0_0_, messagetyp0_1_.bus_thing_oid as bus2_1_0_ from example_mess messagetyp0_ left outer join example_mt1 messagetyp0_1_ on messagetyp0_.oid=messagetyp0_1_.oid where messagetyp0_.oid=? and messagetyp0_.msg_Type='MT564' for update
DEBUG - Static select for entity hib.example.MessageType1: select messagetyp0_.oid as oid0_0_, messagetyp0_1_.bus_thing_oid as bus2_1_0_ from example_mess messagetyp0_ left outer join example_mt1 messagetyp0_1_ on messagetyp0_.oid=messagetyp0_1_.oid where messagetyp0_.oid=? and messagetyp0_.msg_Type='MT564' for update nowait
DEBUG - Static select for entity hib.example.MessageType1: select messagetyp0_.oid as oid0_0_, messagetyp0_1_.bus_thing_oid as bus2_1_0_ from example_mess messagetyp0_ left outer join example_mt1 messagetyp0_1_ on messagetyp0_.oid=messagetyp0_1_.oid where messagetyp0_.oid=? and messagetyp0_.msg_Type='MT564' for update nowait
DEBUG - Static select for action ACTION_MERGE on entity hib.example.MessageType1: select messagetyp0_.oid as oid0_1_, messagetyp0_1_.bus_thing_oid as bus2_1_1_, businessth1_.oid as oid2_0_, businessth1_1_.oid as oid1_0_ from example_mess messagetyp0_ left outer join example_mt1 messagetyp0_1_ on messagetyp0_.oid=messagetyp0_1_.oid left outer join example_bus_thing businessth1_ on messagetyp0_1_.bus_thing_oid=businessth1_.oid left outer join example_mt1 businessth1_1_ on businessth1_.oid=businessth1_1_.bus_thing_oid where messagetyp0_.oid=? and messagetyp0_.msg_Type='MT564'
DEBUG - Static select for action ACTION_REFRESH on entity hib.example.MessageType1: select messagetyp0_.oid as oid0_1_, messagetyp0_1_.bus_thing_oid as bus2_1_1_, businessth1_.oid as oid2_0_, businessth1_1_.oid as oid1_0_ from example_mess messagetyp0_ left outer join example_mt1 messagetyp0_1_ on messagetyp0_.oid=messagetyp0_1_.oid left outer join example_bus_thing businessth1_ on messagetyp0_1_.bus_thing_oid=businessth1_.oid left outer join example_mt1 businessth1_1_ on businessth1_.oid=businessth1_1_.bus_thing_oid where messagetyp0_.oid=? and messagetyp0_.msg_Type='MT564'
DEBUG - Static select for entity hib.example.MessageType1: select messagetyp0_.oid as oid0_2_, messagetyp0_1_.bus_thing_oid as bus2_1_2_, businessth1_.oid as oid2_0_, businessth1_1_.oid as oid1_0_, messagetyp2_.oid as oid0_1_, messagetyp2_1_.bus_thing_oid as bus2_1_1_ from example_mess messagetyp0_ left outer join example_mt1 messagetyp0_1_ on messagetyp0_.oid=messagetyp0_1_.oid left outer join example_bus_thing businessth1_ on messagetyp0_1_.bus_thing_oid=businessth1_.oid left outer join example_mt1 businessth1_1_ on businessth1_.oid=businessth1_1_.bus_thing_oid left outer join example_mess messagetyp2_ on businessth1_1_.oid=messagetyp2_.oid left outer join example_mt1 messagetyp2_1_ on messagetyp2_.oid=messagetyp2_1_.oid where messagetyp0_.bus_thing_oid=? and messagetyp0_.msg_Type='MT564'
DEBUG - initializing class SessionFactoryObjectFactory
DEBUG - registered: 041320741857dc03011857dc04550000 (unnamed)
INFO - Not binding factory to JNDI, no JNDI name configured
DEBUG - instantiated session factory
DEBUG - Checking 0 named HQL queries
DEBUG - Checking 0 named SQL queries
DEBUG - opened session at timestamp: -9223372036854775808
DEBUG - id unsaved-value: 0
DEBUG - transient instance of: hib.example.MessageType1
DEBUG - saving transient instance
DEBUG - generated identifier: 0, using strategy: hib.example.OidGenerator
DEBUG - saving [hib.example.MessageType1#0]
DEBUG - processing cascade ACTION_PERSIST for: hib.example.MessageType1
DEBUG - cascading to persist: hib.example.BusinessThing
DEBUG - id unsaved-value: 0
DEBUG - transient instance of: hib.example.BusinessThing
DEBUG - saving transient instance
DEBUG - generated identifier: 1, using strategy: hib.example.OidGenerator
DEBUG - saving [hib.example.BusinessThing#1]
Exception in thread "main" org.hibernate.PropertyValueException: not-null property references a null or transient value: hib.example.BusinessThing.message
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:609)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:601)
at org.hibernate.engine.CascadingAction$8.cascade(CascadingAction.java:295)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:431)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at hib.example.MessageType1.main(MessageType1.java:42)