-->
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: Map a String type as a object ref using Annotation
PostPosted: Sun Jul 22, 2007 9:05 pm 
Newbie

Joined: Sun Jul 22, 2007 8:07 pm
Posts: 2
Hi
Poor subject title I know, I don't know if this can be done but I'll explain with the example below:

Code:
public class Passport {
...
@ManyToOne
@JoinColumn(name = "COUNTRYCODE")   
private CountryCode country;
...
}



The mapping is a ManyToOne annotation mapping which generates a Varchar in mysql with a FK to CountryCode table. I would like to keep using with hbm2ddl though out my project to generate my db schema but in my object model, I want the country in Passport object to be a type String but still have it generated as with FK to CountryCode table in db. Is there another way to map it with annotation to achieve what I describe above or I just have to maintain my schema myself and give up using hbm2ddl?



Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 23, 2007 9:35 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You can mark this getter as private and create a public getter that does the String transformation.

_________________
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.