-->
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.  [ 1 post ] 
Author Message
 Post subject: Using package-private classes as JPA Entities
PostPosted: Fri Mar 13, 2009 8:41 am 
Beginner
Beginner

Joined: Mon Apr 24, 2006 10:42 am
Posts: 23
Hi,

We try to enforce proper encapsulation in our domain-model, by creating public interfaces for business-entities, and package-private classes that implement those interfaces, and contain JPA (or Hibernate) annotations.

However, this is impossible to do, once you need to map an association, in which the mapped property references the interface, and the targetEntity attribute is required to tell Hibernate the concrete class that should be used.

If the associated class is in a different package, as is often the case, and is not public - then it is impossible to map.

The implication is that JPA forces us to make all entities public.

Is there any solution?

Thanks,
Naaman


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

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.