Reputation: 43043
I have built a standalone java application (batch) that make use of Hibernate through JPA 2. It runs fine but I constantly see this warning in the logs.
I have googled and read the source code directly with no luck.
WARN org.hibernate.type.TypeFactory TypeFactory.java:69 Scoping types to session factory org.hibernate.impl.SessionFactoryImpl@f876ce2 after already scoped org.hibernate.impl.SessionFactoryImpl@3fd7165
I wonder what does it mean ?
Upvotes: 3
Views: 2326
Reputation: 2739
This is when you set the session factory twice (the session factory has already been set). Set logging to trace and look for where it says 'Scoping types to session factory', at some point you then set it again, it appears it won't cause a problem though but the API looks like that in an ideal scenario you should only ever set the factory once.
Upvotes: 2
Reputation: 9134
Directly from the sources:
public final class TypeFactory implements Serializable {
private static final Logger log = LoggerFactory.getLogger( TypeFactory.class );
private final TypeScopeImpl typeScope = new TypeScopeImpl();
public static interface TypeScope extends Serializable {
public SessionFactoryImplementor resolveFactory();
}
private static class TypeScopeImpl implements TypeFactory.TypeScope {
private SessionFactoryImplementor factory;
public void injectSessionFactory(SessionFactoryImplementor factory) {
if ( this.factory != null ) {
log.warn( "Scoping types to session factory {} after already scoped {}", this.factory, factory );
}
else {
log.trace( "Scoping types to session factory {}", factory );
}
this.factory = factory;
}
...
Upvotes: 1