-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: NullPointerException on DDL creation
PostPosted: Thu Nov 17, 2005 5:58 am 
Newbie

Joined: Thu Nov 17, 2005 5:36 am
Posts: 3
I am trying to generate DDL schema from worked POJO classes using Hibernate Annotations. I was able to generate it using non-annotated Hibernate (hbm.xml) using the same classes.

I've tried to follow the hibernate docs and EJB3 specs, but still can't get any result.

This is the messages from eclipse console :

Code:
- Using dialect: org.hibernate.dialect.MySQLDialect
- processing extends queue
- processing collection mappings
java.lang.NullPointerException
   at org.hibernate.util.StringHelper.qualify(StringHelper.java:264)
   at org.hibernate.cfg.ToOneMappedBySecondPass.doSecondPass(ToOneMappedBySecondPass.java:38)
   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1023)
   at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:218)
   at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:638)
   at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:94)
   at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:62)
   at com.aaa.bbb.CreateDatabase.exportTables(CreateDatabase.java:62)
   at com.aaa.bbb.CreateDatabase.main(CreateDatabase.java:12)


Any idea what might caused it?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 8:50 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
can you isolate the issue with a couple of classes and post it to JIRA?
That'd be great

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 11:16 pm 
Newbie

Joined: Thu Nov 17, 2005 5:36 am
Posts: 3
I solved the problem.

It is because I'm not inserting other-side class (on @OneToOne relation) in my schema generator (which is not needed in non-annotated version) : AnnotationConfiguration().addAnnotatedClass(otherClass.class).addAnnotatedClass...bla....bla....

I've temporarily change the code ToOneMappedBySecondPass.java in package org.hibernate.cfg line 38 :

Code:
         throw new AnnotationException("Unknown mappedBy in: " + StringHelper.qualify(ownerEntity, ownerProperty)
               + ", referenced property unknown: "
               + StringHelper.qualify( value.getReferencedEntityName(), value.getReferencedPropertyName() )


The NullPointerException actually raised from the second StringHelper.qualify (line 40).

So I've commented line 39 & 40 to track down the problem.

Suggestion :
To made more informative errors, how about checking every null possible values (if it is null) before printed them. In this case the get getReferencedEntityName() and getReferencedPropertyName().

Thanks for the response.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.