[Hibernate-JIRA] Created: (EJB-339) Duplicate Loading of META-INF/orm.xml if specified in perstistence.xml
by Mirko Novakovic (JIRA)
Duplicate Loading of META-INF/orm.xml if specified in perstistence.xml
----------------------------------------------------------------------
Key: EJB-339
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-339
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.1.GA
Environment: JBoss 4.2.2.GA
Sun Java 6
Reporter: Mirko Novakovic
Priority: Minor
I had specified <mapping-file>/META-INF/orm.xml</mapping-file> in my persistence.xml to load the standard orm.xml, which included some named queries. When deploying and starting the application in JBoss, I get the following exception:
org.hibernate.DuplicateMappingException: Duplicate query mapping
After removing the <mapping-file>/META-INF/orm.xml</mapping-file> from my perstistence.xml, the application works fine.
It seems that the EntityManager loads the default META-INF/orm.xml and the one specified in the persistence.xml, even if they are the same. This is not a big issue, but took me some time to find it out and I think it would be better to log a warning in this case or just ignore duplications.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 10 months
[Hibernate-JIRA] Created: (HHH-3117) Proposal for better (more speaking) Exceptions
by Daniel Migowski (JIRA)
Proposal for better (more speaking) Exceptions
----------------------------------------------
Key: HHH-3117
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3117
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Reporter: Daniel Migowski
Priority: Minor
Currently I get LazyInitializationExceptions in my Logfiles. To debug them, it would be great to know from with lazy objects they originate. To achive this I currently override the AbstractLazyInitializer class and add the entityName and Id to the ExceptionText. The modified source is like this (Just the exception messages have been modified):
public final void initialize() throws HibernateException {
if (!initialized) {
if ( session==null ) {
throw new LazyInitializationException("could not initialize proxy for "+entityName+"("+id+") - no Session");
}
else if ( !session.isOpen() ) {
throw new LazyInitializationException("could not initialize proxy for "+entityName+"("+id+") - the owning Session was closed");
}
else if ( !session.isConnected() ) {
throw new LazyInitializationException("could not initialize proxy for "+entityName+"("+id+") - the owning Session is disconnected");
}
else {
target = session.immediateLoad(entityName, id);
initialized = true;
checkTargetState();
}
}
else {
checkTargetState();
}
}
private void checkTargetState() {
if ( !unwrap ) {
if ( target == null ) {
getSession().getFactory().getEntityNotFoundDelegate().handleEntityNotFound( entityName, id );
}
}
}
public final void setSession(SessionImplementor s) throws HibernateException {
if (s!=session) {
if ( isConnectedToSession() ) {
//TODO: perhaps this should be some other RuntimeException...
throw new HibernateException("illegally attempted to associate a proxy for "+entityName+"("+id+") with two open Sessions");
}
session = s;
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 10 months