Hibernate version:3.1alpha1
Hi, Im trying to create my database schema from my bean classes.. I made this simple test and Im getting a null pointer exception.. here's how my classes are:
CLASS BOOK ( The 'Many' side ):
...
...
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn( name="customer_fk" )
public Customer getCustomer()
{
return this.customer;
}
@Id
public java.lang.Integer getId()
{
return id;
}
...
CLASS CUSTOMER ( The 'One' Side ):
@OneToMany( cascade = CascadeType.ALL, fetch = FetchType.LAZY )
@Id
public Integer getId()
{
return this.id;
}
....
And when I try to export the schema like this:
...
try
{
cfg = new AnnotationConfiguration( );
cfg.configure( CONFIG_FILE_LOCATION );
cfg.addAnnotatedClass( Book.class );
cfg.addAnnotatedClass( Customer.class );
SchemaExport se = new SchemaExport( cfg );
se.create( true , true );
}
...
I get this exception:
Exception in thread "main" java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:396)
at java.util.Properties.setProperty(Properties.java:128)
at org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1345)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:863)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:575)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:194)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:570)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:64)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:49)
at br.com.mindsatwork.libraryweb.test.SchemaBuilder.main(SchemaBuilder.java:49)
I have no Idea of what is going on... Any help is welcome..
thanks!!!
|