[hibernate-issues] [Hibernate-JIRA] Updated: (ANN-617) NullPointerException when handling @OrderBy

Jifeng Liu (JIRA) noreply at atlassian.com
Mon Jun 4 15:46:04 EDT 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jifeng Liu updated ANN-617:
---------------------------

    Attachment: test.zip

Test case. 

> NullPointerException when handling @OrderBy
> -------------------------------------------
>
>                 Key: ANN-617
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-617
>             Project: Hibernate Annotations
>          Issue Type: Bug
>          Components: binder
>    Affects Versions: 3.3.0.ga
>         Environment: Hibernate Core 3.2.4.SP1; Hibernate Annotations 3.3.0 GA; Hibernate EntityManager 3.3.1 GA; Oracle OC4J; Oracle DB 10g
>            Reporter: Jifeng Liu
>         Attachments: test.zip
>
>
> After I updated from Hibernate Annotations 3.2.1ga to 3.3.0ga, I get the following NullPointerException:
> Caused by: java.lang.NullPointerException
> 	at org.hibernate.cfg.annotations.CollectionBinder.buildOrderByClauseFromHql(CollectionBinder.java:851)
> 	at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1133)
> 	at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:576)
> 	at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:517)
> 	at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
> 	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
> 	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:316)
> 	at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
> 	at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269)
> 	at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150)
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888)
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:416)
> 	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:138)
> 	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:114)
> 	at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.createContainerEntityManagerFactory(PersistenceUnitManagerImpl.java:175)
> After I debug it, the variable 'pc' is null in the CollectionBinder.java:851 line:
>             table = pc.getTable().getQuotedName() + ".";
> It seems like this bug is introduced by fix of ANN-516 '@OrderBy added to wrong table in inheritance relationship'.
> The related persist classes are:
> // ------ The class with @OrderBy annotation
> @Entity
> @Table(name="RG_SECTION")
> @IdClass(SectionID.class)
> public class Section extends AbstractSection{
> 	@ManyToMany(fetch=FetchType.EAGER)
> 	@JoinTable(name="V_Current_Section_Term",
> 		joinColumns= {
> 			@JoinColumn(name="Section_School_Id", referencedColumnName="School_Id"), 
> 			@JoinColumn(name="Section_ID", referencedColumnName="Section_ID")},
> 		inverseJoinColumns= {
> 			@JoinColumn(name="Term_School_Id", referencedColumnName="School_Id"), 
> 			@JoinColumn(name="Term_Academic_Yr", referencedColumnName="Academic_Yr"),
> 			@JoinColumn(name="Term_Sort_No",referencedColumnName="Term_Sort_No")}
> 	)	
> 	@OrderBy("termSortNo")
> 	public List<Term> getTerms() {
> 		return super.getTerms();
> 	}
> // -------------- This Entity class in the Collection ---------
> @Entity
> @Table(name="SCHOOL_TERMS")
> @IdClass(TermID.class)
> public class Term extends AbstractBusinessObject implements Comparable{
> ....

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list