NullPointerException « Composite « JPA Q&A





1. Hibernate n:m extractHashCode throws NullPointerException    stackoverflow.com

I get the following exception while inserting an object with hibernate. Reading from the database works like a charm. I use MySQL 5.5 as database provider and hibernate 3.6.5. I have the ...

2. NullPointerException from merge on composite id    forum.hibernate.org

Hello I'm facing a bug on hibernate. When i attempt to merge an entity which contains a composite id, the merge method throws a NPE. I found a JIRA opened on the issue and it seemed it is a well known bug unresolved. => http://opensource.atlassian.com/projects/hibernate/browse/HHH-2326 Does anyone know more about this issue and especially if it has been resolved on 3.5.* ...

3. NullPointerException when order by a composite ID field    forum.hibernate.org

Hi I read on another forum that a NullPointerException occurs when a property of a composite ID (@EmbededId or @IdClass) is used for ordering. In my case too, this @OrderBy annotation causes the exception: @OrderBy("drel"). "Drel" is a field of a composite ID. How can I do to order the list by drel? @OneToMany(mappedBy = "pid", fetch=FetchType.LAZY) @Sort(type = SortType.NATURAL) @OrderBy("drel") ...

4. NullPointerException on merging an composite-id entity    forum.hibernate.org

When a entity who has any map associations where the elements have composite keys are merged, an null pointer exception is raised, below is the stack trace. Code: java.lang.NullPointerException at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:169) at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:199) at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3605) ...

5. NullPointerException: join fetch & set of composite-elements    forum.hibernate.org

Class Company has a many-to-one relationship to Person (chief) which has a set of composite-elements (addresses). The Line: Session.createQuery( "from Company c join fetch c.owner o join fetch o.addresses a") produces a Nullpointer Exception. Here is my test code (tested with hibernate-core-3.3.0.SP1): Configuration cfg = new Configuration().addDirectory(new File("src/main/java/org/donmiguel")); Properties p = new Properties(); p.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); p.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"); p.setProperty("hibernate.hbm2ddl.auto", "create-drop"); p.setProperty("hibernate.connection.username", "sa"); ...