-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping Interfaces
PostPosted: Wed May 29, 2013 2:46 am 
Beginner
Beginner

Joined: Tue Nov 02, 2010 4:29 am
Posts: 21
I am trying to implement a Hibernate version of Spring Security's ACL domain model.
e.g. http://static.springsource.org/spring-security/site/docs/3.1.x/apidocs/org/springframework/security/acls/model/Acl.html
It's (quite rightly) built around interfaces which my entities will implement.
I usually use annotations to configure Hibernate, but I obviously can't annotate Spring Security's interfaces.
I wonder if I can map them in an XML mapping file?
Most of the interfaces don't provide an ID candidate, so will Hibernate even allow me to used them as 'super classes' to my implementation entities?
I'm using Spring Security 3.x and Hibernate 3.x
Can I mix the xml definition for the Spring interfaces with annotations on the implementing entity classes or does the whole class hierachy have to be implemented in XML/


Top
 Profile  
 
 Post subject: Re: Mapping Interfaces
PostPosted: Wed May 29, 2013 10:05 am 
Beginner
Beginner

Joined: Tue Nov 02, 2010 4:29 am
Posts: 21
I may be able to partially answer my questions about IDs. It does appear to be a problem.
I tried adding

Code:
<hibernate-mapping package="org.springframework.security.acls.model">
     <class name="Acl" table="acl">
             <id name="id" column="id">
             </id>   
   </class>
</hibernate-mapping>


to hbm.xml and got an exception caused by:

org.hibernate.PropertyNotFoundException: field [id] not found on org.springframework.security.acls.model.Acl

The DTD seems to require and id but I was wondering whether it's possible to allow the subclasses to provide it?


Top
 Profile  
 
 Post subject: Re: Mapping Interfaces
PostPosted: Wed May 29, 2013 10:26 am 
Beginner
Beginner

Joined: Tue Nov 02, 2010 4:29 am
Posts: 21
I'm wondering if I can not worry about mapping the interfaces and just use my implementation class entities with something like:

Code:
private HibernateAcl parentAcl;

...

@ManyToOne(targetEntity=HibernateAcl.class)
@Override
public Acl getParentAcl()
{
   return parentAcl;
}


I will give it a try.


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