-->
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: Embedded objects containing only one persisted field.
PostPosted: Sat Feb 17, 2007 11:44 am 
Newbie

Joined: Fri Feb 16, 2007 6:48 pm
Posts: 1
Hi,

I'd like to know 2 simple things about embedded objects containing only one persisted field:

1. Is is possible to access a custom type (marked as embeddable) value via its name instead of the field's name it contains using HQL ?
For instance:

Code:
@Embeddable
public class Text {
public String value;

// ... some not persisted fields
}

Using a HQL query like:
Code:
"from Foo f where f.textField = 'plop'"

Instead of:
Code:
"from Foo f where f.textField.value = 'plop'"


2. Is it possible to ask hibernate to automatically map the embedded Text.value column name to the name of the field using it or even better, to remove the @Embedded ?

For instance:
Code:
@Entity
public class TextUser {
...
Text getMytext() {
return mytext;
}
}

Instead of:
Code:
@Entity
public class TextUser {
...
@Embedded
@AttributeOverride(name = "value", column = @Column(name = "mytext"))
Text getMytext() {
return mytext;
}
}


I'm open to any suggestions / advice!
Cheers,
Fred


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 20, 2007 7:52 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
1. is not
2. is possible through a user type @Type

_________________
Emmanuel


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.