-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: MappingException: Unknown entity EntityName_$$_javassist_57
PostPosted: Fri Jun 30, 2006 4:39 am 
Newbie

Joined: Sun Oct 12, 2003 4:21 pm
Posts: 16
Location: Stockholm, Sweden
Hi, I'm in the end of converting my project from Hibernate2 to Hibernate3.
I can login and browse records, but as soon as I try to save/persist something I get an exception.
To me it sounds like a classloader/bytecode enhancer issue.
Can anyone point me in a direction where to investigate?

Hibernate version:
From the hibernate3.jar manifest:
Specification-Version: 4.0.4.GA
Implementation-Vendor-Id: http://www.jboss.org/
Hibernate-Version: 3.2.0.cr2
Implementation-Version: 3.2.0.cr2

Code between sessionFactory.openSession() and session.close():
Home made web framework ;-) Opening session at HTTP GET, closing it after a redirect. Maybe the problem is here, because the session disconnect/reconnect has changed between h2 and h3.
I'm right now investigating this, but could need all the help I can get.

Full stack trace of any exception that occurs:
Code:
10:16:03,415 ERROR [STDERR] Caused by: org.hibernate.MappingException: Unknown e
ntity: com.xyz.activity.ActivityType_$$_javassist_57
10:16:03,415 ERROR [STDERR]     at org.hibernate.impl.SessionFactoryImpl.getEnti
tyPersister(SessionFactoryImpl.java:547)
10:16:03,431 ERROR [STDERR]     at org.hibernate.event.def.DefaultLoadEventListe
ner.onLoad(DefaultLoadEventListener.java:65)
10:16:03,431 ERROR [STDERR]     at org.hibernate.impl.SessionImpl.fireLoad(Sessi
onImpl.java:871)
10:16:03,431 ERROR [STDERR]     at org.hibernate.impl.SessionImpl.load(SessionIm
pl.java:788)
10:16:03,431 ERROR [STDERR]     at org.hibernate.impl.SessionImpl.load(SessionIm
pl.java:781)


Thanks.

/Goran


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 30, 2006 5:26 am 
Newbie

Joined: Sun Oct 12, 2003 4:21 pm
Posts: 16
Location: Stockholm, Sweden
Problem solved!!! (I hope)

I was trying to refresh an object from database (before updating it), in an over-complicated way:
Code:
else if (getModel().getId() != null) {
            // Refresh existing root entity.
            Class existingClass = getModel().getClass();
            String currentPrimaryKey = getModel().getId();
            if (log.isDebugEnabled()) {
                log.debug("Refreshing root entity: " + existingClass.getName()
                        + "@" + currentPrimaryKey);
            }
            setModel((AbstractEntity) session.load(existingClass,
                    currentPrimaryKey));
        }

The getClass() returned the enhanced class name and thus did not work with session.load().

I replaced all of this with a one-liner:
Code:
session.refresh(getModel());

And things started to work much better.
I have not tested everything yet, so I may run into other problems.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.