-->
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: Allow for "missing" fields of embeddable classes
PostPosted: Fri Feb 03, 2006 3:56 pm 
Newbie

Joined: Fri Feb 03, 2006 3:42 pm
Posts: 4
Location: Manassas, VA USA
I'm searching for a way to reuse common embeddable classes. For example, a generic Name class would contain all name parts (first, last, middle, prefix, suffix, nickname). However database tables in different projects would contain at least the first and last name, but may be missing other name fields.

It would be counterproductive to create a new Name class for every different database implementation and inheritance doesn't seem like a plausible solution. I also will not necessarily be able to modify the database tables.

I was hoping for some way via the AttributeOverride to say "just put a NULL here" such that the generated SQL would contain "NULL AS columnName" for the attributes that I choose to "ignore". That seems like the cleanest approach to me.

Has anyone tried to solve this problem or should I just get over it?

I am using Annotations 3.1.beta8 and EntityManager 3.1.beta6 with Hibernate 3.1.2 and an MS SQL Server db.

Thanks.

_________________
Bill Squires


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 04, 2006 11:57 am 
Newbie

Joined: Fri Jan 27, 2006 10:48 am
Posts: 2
Why not create superclass with often used fields and add subclasses when you will find that you need add some fields?

I did not tested this for embeddable classes, but this works for embedded composite id.


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.