-->
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: Annotations and inherited properties
PostPosted: Fri May 27, 2005 10:43 pm 
Senior
Senior

Joined: Thu May 12, 2005 11:40 pm
Posts: 125
Location: Canada
I have a few 'base types' in my model, for example 'Entity', which hold properties that are common to all entities, for example 'id'. If the column names of such properties were all the same (if, for example, all my PKs were named 'ID'), then I could just throw an @Id on the property in the base type and all would be well. However, this is not the case. The base type properties actually differ in name based on their table (for example TABLE_ID, TABLE_NAME, TABLE_DESC, etc), so it is not possible to map them in the base type using a single @Column(). I can get around this by annotating the properties in the base types with @Transient then copying/pasting the getter into the concrete type and annotating with @Column() there, but that's lame.

Is there any way to 'override' annotations, or cause them to compute the name parameter dynamically, or something else which could allow me to map this in an elegant way?

By the way, I want to say that I'm really digging this annotation stuff. Even if I do end up having to do this the hard way, it's a lot better than XML or Xdoclet. In a way I'm almost glad I'm having this problem. I could just as easily be having problems with straight JDBC data access code, and those are much less entertaining. I love hibernate <3 *sniff*


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.