-->
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: What is the diff between Embedding and Custom Mapping Type
PostPosted: Wed May 20, 2009 10:36 pm 
Newbie

Joined: Tue Oct 02, 2007 3:49 am
Posts: 17
Hi All,
I'm now going to implement the GMT time in my application. It contains the time zone and the time value. At first, I planned to implement it by creating an embeddable class "GMT" for it. Since it will generate two db columns "timezone" and "time" in the table which contain the class "GMT". However, after reading an article, an example "MonetaryAmount" was implemented using custom mapping type. And it seems work applying on my case. Thus, I'm so confused which method I should follow with. Because both methods look doing same kind of thing. Can anyone tell me what's diff between these two method and which's the best way to do on my case? Many thanks

Best Rdgs
Ellis


Top
 Profile  
 
 Post subject: Re: What is the diff between Embedding and Custom Mapping Type
PostPosted: Thu May 21, 2009 12:44 am 
Newbie

Joined: Tue May 19, 2009 11:22 am
Posts: 6
Can you please be elaborate on the part - "embedding".

If you are creating a separate class for GMT, how are you mapping it?

I think we should go for custom user types, when we want use the custom type columns in our queries.

Did that answer your question ?


Top
 Profile  
 
 Post subject: Re: What is the diff between Embedding and Custom Mapping Type
PostPosted: Thu May 21, 2009 5:31 am 
Newbie

Joined: Tue Oct 02, 2007 3:49 am
Posts: 17
For example, if I do it by embedding, I can create a class "GMT" and coding as below

Code:
@Embeddable
public class GMT implements Serializable {
   @Column(name = "timezone")
   private String zone ;

             @Temporal(TemporalType.TIMESTAMP)
           @Column(name = "timevalue")
             private Date timevalue;
.......



In this way, it seem doing the same as custom mapping type. Am I right?

Best Rdgs
Ellis


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.