-->
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: How to reuse hibernate mapping?
PostPosted: Thu Aug 25, 2011 11:58 am 
Newbie

Joined: Wed Mar 30, 2011 10:22 pm
Posts: 10
Hello, everybody!
My project has functionality which is pretty generic, and I'd like to reuse it in another project.
In other words I'd like to have a jar file which defines several interfaces/classes and maps then to database tables.
Later, when add this jar to another project which also has hibernate mapping, both mappings should be merged together.
In ideal case I'd like just add jar to class path, but some configuration/initialization is Ok.

What would be the best way to do it?

Thank you,
Andrey


Top
 Profile  
 
 Post subject: Re: How to reuse hibernate mapping?
PostPosted: Tue Oct 25, 2011 11:44 pm 
Newbie

Joined: Wed Mar 30, 2011 10:22 pm
Posts: 10
I guess I have to clarify my question. Let's say I have two entities:

interface User{
long getId();
String getName();
}

@Entity
class Something {
@Id
long id;
@ManyToOne
User user;
}

I want to use interface because I don't know the concrete implementation of User interface. I want to ship these two classes as library (jar file).

Later I want to add this jar to another project which has implementation of User:

@Entity
class UserImpl implements User{
@Id
long id;
String name;
...
}

At this moment I expect Hibernate to build ManyToOne relationship between Something and UserImpl.

Any ideas how to achieve this?

Thank you,
Andrey


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.