-->
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.  [ 1 post ] 
Author Message
 Post subject: Newbie's Question
PostPosted: Wed Jun 09, 2010 3:35 am 
Newbie

Joined: Wed Jun 09, 2010 3:14 am
Posts: 2
Hello everyone:
I am new to ORM, Hibernate and JPA. I have learnt some hibernate and jpa knowledge from two books I bought recently. One is the "Hibernate made easy" and the other is the "Java Persistence with Hibernate".
I am currently developing my own web applications, and currently I am working on the ORM part. Since I am pretty new to Hibernate, I hope to get some help from all the experts around here. Alright, here my question is.

If I am building an option to let online users select ways of paying for a certain service (e.g. 15 USD/month ), what would be the best way to map the tables with java objects? My personal idea would be to create a table for the service that is being selected based on, maybe called "services", with a java class called "Service". Within this "services" table, I create 2 fields, one is the Primary key (id), the other is the Foreign key referencing to the PK of another table called "charge_methods" which is mapped by a Java class called "ChargeMethod". There are 3 fields in the "charge_methods" table; they are "amount"(15), "currency"(USD) and "payPeriod"(Month). By doing this way, I assume I will have to create hibernate custom mapping type for "currency" and "payPeriod", because each of these 2 is also a Java Enumeration containing different currency and pay period, such as USD, CAD, EUR for the currency field and Month, Year, Day for the pay period. My question is if I really do this way, do I really need to create custom mapping type even if I use JPA? Do mapping Java Enumeration always require custom mapping? if this way is not recommended, what would you suggest?


Much appreciated!


Phil


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.