Hi Sanne, as mentioned above I'm calling configure on AnnotationConfiguration which extends org.hibernate.cfg.Configuration.
By the way:
Code:
private final static java.util.Properties HIBERNATE_PROPERTIES;
private final static Class<?>[] MAPPED_CLASSES;
private static void initMappedClasses(final AnnotationConfiguration aConfig) {
for (final Class<?> toBeMapped : MAPPED_CLASSES) {
aConfig.addAnnotatedClass(toBeMapped);
}
}
private static SessionFactory initFactory() {
final AnnotationConfiguration aConfig = new AnnotationConfiguration();
aConfig.addProperties(HIBERNATE_PROPERTIES);
initMappedClasses(aConfig);
return aConfig.configure().buildSessionFactory();
}
So you mean I should use:
Ejb3Configuration
Code:
public Ejb3Configuration configure(javax.persistence.spi.PersistenceUnitInfo info,
Map integration)
Process configuration from a PersistenceUnitInfo object Typically called by the container
instead?
But how do i get a PersistenceUnitInfo ?
I have tried to figure that out by the API, but at
javax.persistence.Persistence I ran into a circle.
I want to get rid of any xml-file.
I believe I have found a solution in the meanwhile: All I have to do is to drop the configure-statement:
Code:
aConfig.configure().buildSessionFactory();
changes to:
Code:
aConfig.buildSessionFactory();
It seems to work. Is this correct?
Greetings Michael