[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Approach for mappng a properties table
bryan.kearney
do-not-reply at jboss.com
Wed Mar 18 12:42:13 EDT 2009
I am looking for advice on how to map a properties table. Assume a schema such as:
Objects_Table
ObjectID
ObjectName
ObjectType
Properties_Table
ObjectID
PropertyID
PropertyValue
Assuming that for OID 12 there are 2 properties (NAME and Description) I would like to map a class which looks like
ClassA
- getName()
- setName()
- getDescription()
- setDescription()
I have looked at two approaches for this, and was curious if there was other:
First: Map Objects_Table to ClassA, and give it a relatioship of Properties (@OneToMany). Then, hand craft the getters and setters to manage the properties. This works fine, but searching will be a bit sketchy to code.
Second: Map both tables to ClassA using customer @Loader and @SqlInsert commands. These in turn are backed by heavily joined queries and/or stored procedures. This hides the underlieing tables (good) but requires lots of hand crafted SQL code.
Are there other approaches to this?
-- bk
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4219167#4219167
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4219167
More information about the jboss-user
mailing list