-->
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: Make embedded field transient in child class
PostPosted: Tue May 30, 2006 10:04 am 
Newbie

Joined: Tue May 30, 2006 9:45 am
Posts: 5
I have following classes:

deal class:
Code:
@EmbeddableSuperclass
class Deal {
   private String source;

   @Column(name = "SOURCE")
   public String getSource() {
      return source;
   }

   public void setSource(String source) {
      this.source = source;
   }
}


order class:
Code:
@Entity
@Table(name="ORDERS")
public class Order {
   
   private Deal deal;

   @Embedded
   @AttributeOverrides(value = {
         @AttributeOverride(name = "source", column = @Column(name="NULLCOLUMN", insertable=false,updatable=false))})
   public Deal getDeal() {
      return deal;
   }

   public void setDeal(Deal deal) {
      this.deal = deal;
   }
}


As you can see I don't want to see Source property from Deal class in Order class (don't want to get in from database or save it back). How can we make it transient? For now we do annoying @AttributeOverride on unused NULLCOLUMN with updatable and insertable flags set to false..


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 12:07 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Besides that it goes against all the OO rules. This is actually not possible

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 4:10 am 
Newbie

Joined: Tue May 30, 2006 9:45 am
Posts: 5
emmanuel wrote:
Besides that it goes against all the OO rules. This is actually not possible

yes, I understand, but unfortunatelly we have existing DB structure and don't want to change it heavily..

have we any possibilities to change that Hibernate behaviour? Maybe by creating our own annotation tag?


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.