-->
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: Hibernate To work With Interface
PostPosted: Fri May 07, 2004 2:47 pm 
Newbie

Joined: Fri Apr 02, 2004 4:01 pm
Posts: 2
Hi,

In any application if we use proxy object which was instantiated from the interface and using the same proxy object to Hibernate Api we should be able store, update or delete data.

We were able to make the Hibernate API to work with interface with some changes and implementing few other class for creating proxy object using java reflection.
We thought it is a kind good feature for hibernate to support with interfaces.

Here are steps
1.Define interface name in mapping file same as class name .
<class name="com.test.to.TestAccountBean" table="TEST_ACCOUNT">
where TestAccountBean is an interface. Rest everything in mapping file remains same.

2.Now Create a proxy object using interface, Class which generates proxy object is implemented to generate the hashcode() and equals() method for the proxy object generated from interface.

3.Now using this proxy object we can save, delete or update.

4.when retrieving values it is possible from hibernate API to identify whether it is an interface, if it is an interface then it will generate the proxy object and send back to use

5.Other than 2 new files( for generating proxy) we found that there is required to make changes at Hinernate api for these 3 file.
net.sf.hibernate.impl SessionFactoryImpl.
net.sf.hibernate.persister.AbstractEntityPersister
net.sf.hibernate.type ComponentType

If it makes sense and finds worth to be part of hinernate, we will be providing those files and changes made. As generating proxy object using interface is provided by jdk and anyone code be able to use the interface.

Looking forward for the concerned person reply.

Thanks
Srinivas


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 10:32 am 
Beginner
Beginner

Joined: Sat Jan 17, 2004 5:35 am
Posts: 25
Location: Birmingham, UK
Looks similar to a problem I've recently posted:
http://forum.hibernate.org/viewtopic.php?t=930795

Although I require support for objects that implement multiple interfaces, each of which may provide Hibernate mappings. Would your patch solve this problem?

Cheers,

Mark


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.