Hi, I’m relatively new to hibernate and trying to get the tools to work in eclipse so I can generate DB schema from my POJOs.
Despite my project building and running fine, I’m getting a SessionFactory error: INSTANCE when I try to expand the SessionFactory item in the Hibernate Configuration. I’ve read
http://stackoverflow.com/questions/5106 ... h-struts-1 that this can be caused by several version of the hibernate jar on the class path. I’ve checked my build path and I can’t think how this could be the case.
Code:
java.lang.NoSuchFieldError: INSTANCE
at gemcattle.db.hibernate.CoordsCompositeType.getPropertyTypes(CoordsCompositeType.java:50)
at org.hibernate.type.CompositeCustomType.getColumnSpan(CompositeCustomType.java:183)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:275)
at org.hibernate.mapping.Property.isValid(Property.java:217)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:464)
at org.hibernate.mapping.RootClass.validate(RootClass.java:236)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1193)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1378)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at org.hibernate.console.ConsoleConfiguration$4.execute(ConsoleConfiguration.java:241)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:72)
at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:236)
at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:43)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:100)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
The offending line in CoordsCompositeType is the return line here (you can see I’ve tried various options)
Code:
@Override
public Type[] getPropertyTypes() {
return new Type[]{IntegerType.INSTANCE, IntegerType.INSTANCE};
// return new Type[]{StandardBasicTypes.INTEGER, StandardBasicTypes.INTEGER};
// return new Type[]{Hibernate.INTEGER, Hibernate.INTEGER};
// return new Type[]{Hibernate.BIG_DECIMAL, Hibernate.BIG_DECIMAL};
}
I notice that it works fine when I remove my CoordsCompositeType from my hibernate.cfg.xml mapping
Would really appreciate some pointers. I’m using eclipse Helios SR2 and hibernate tools 3.4.0, and can post more conde/config if necessary.
Thanks