-->
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: How to override an embedded field to transient
PostPosted: Sat Nov 15, 2008 6:08 am 
Newbie

Joined: Sat Nov 15, 2008 3:34 am
Posts: 1
Location: Lahore
I would like to know if it is possible to override an embedded field to turn it transient. The use case is:


@Embeddable
public class Person {
private String name;
private Date dateOfBirth;
...
@Column(name = "NAME")
public String getName() {
return name;
}
@Column(name = "BIRTH")
public Date getDateOfBirth() {
return dateOfBirth;
}
...
}

@Entity
public class Actor {
private Person person;
...
@Embedded
// I need to turn dateOfBirth transient
public Person getPerson() {
return person;
}
...
}

Any way to do this.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2008 4:04 pm 
Newbie

Joined: Wed Dec 03, 2008 3:52 pm
Posts: 1
Same issue here...although I'm not using the @Embedded annotation.

Code sample:

Code:
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@MappedSuperclass
public class BaseClass
{

private Date date;

@Column(name = "date")
public Date getDate() {
     return date;
}

@Entity(name = "subclass")
public class SubClass extends BaseClass

// This subclass table does not hold a date, so I want it to be transient
@Override
@Transient
public Date getDate() {
  return null;
}


Now, I understand I can't override the @Column annotation with the @Transient. After some googling I found some results on a @TransientOverride annotation (http://forum.hibernate.org/viewtopic.php?p=2395197) but I can't find that one in the javax.persistence set or org.hibernate.annotations set...


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.