-->
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.  [ 6 posts ] 
Author Message
 Post subject: Problem with dynamic models
PostPosted: Tue May 17, 2005 12:39 pm 
Newbie

Joined: Tue May 17, 2005 11:59 am
Posts: 5
Hibernate version: 3.0.3

Hi,

I'm been using Hibernate since 3.0 alfa, and what I'm trying to do is to persist EMF dynamic instances.
With Hibernate 3.0 alfa, I was able to do this, by using an Interceptor to instanciate the object using the entity name, which corresponds to the EMF class name, and providing a custom PropertyAccessor to each property (using the access attribute in the mapping XML file).
However, this aproach doesn't work now with Hibernate 3.0.3. I updated my code to be compatible with the new version, but now it's always trying to use the MapAccessor instead of the one I provided, which will cause an exception.

Does anyone knows what's the cause?

thanks in advance,

Rui Figueira


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 2:35 pm 
Newbie

Joined: Tue May 17, 2005 11:59 am
Posts: 5
I've been debugging and found that the problem is that the interceptor is not being invoked. I had to specify the class name in the mapping file (I used org.eclipse.emf.ecore.impl.DynamicEObjectImpl), but I was hoping that interceptor would be invoked to instanciate the object, as it used to do in hibernate 3.0 alfa. However, and because I provided the class name, it automaticaly instanciates it and doesn't invoke the method instanciate at Interceptor first.
I tried to delete the class name in the mapping file and just leave the entity-name, but that way hibernate considers it a Map (it instanciates the object using the Interceptor properly, but the PropertyAccessor it is trying to use is the MapAccessor and not the one I specified).


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 4:29 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
I am doing a VERY similar thing using another open source project. Take a look creating your own EntityPersister. You'll need to create your own Instantitor, Tupilizer on top of using your current PropertyAccessor.

_________________
Matt Veitas


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 8:05 pm 
Newbie

Joined: Tue May 17, 2005 11:59 am
Posts: 5
Thanks Matt for the response.
Can you tell me which open source project are you working on, so that I can take a look on that?
Another thing: how about opening a bug requesting some redesign for dynamic models? For instance, it should be possible to indicate a factory class in the mapping file, that would be responsible for instanciating the object, and two new factory methods should be added to PropertyAccessor to create Getter and Setter given the entity name and the property.
I believe these two changes would simplify the persistence of other models than POJOs and Maps.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 11:03 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
Check out Meta-JB... http://www.sf.net/projects/meta-jb

Specifically the org.progeeks.meta.hibernate package.

_________________
Matt Veitas


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 18, 2005 5:11 am 
Newbie

Joined: Tue May 17, 2005 11:59 am
Posts: 5
Matt, thanks for your help once again!

Rui Figueira


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.