-->
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: Complex Single Table Mapping
PostPosted: Thu Jul 01, 2010 3:30 pm 
Newbie

Joined: Thu Jul 01, 2010 3:14 pm
Posts: 1
Hi, I'm relatively new to Hibernate (though I have done a fair amount of general JPA work) and I have having serious trouble finding information on the following.

I would like to create an Entity that looks like (annotations/getters/setters omitted):
public class TestEntity
{
@Id
private Long pk;
public ComplexPojo fieldOne;
public ComplexPojo fieldTwo;
. . .y
public ComplexPojo fieldX;
}

public class ComplexPojo
{
public String value;
public Integer version;
}

ideally when this persists in the database it looks like
table: TestEntity
-------------------------------
Key | FieldOneValue | FieldOneVersion | FieldTwoValue | FieldTwoVersion etc ...

I have found ways to persist this structure in a "Many to One" environment, but in the interest of keeping this readable by humans I would like to keep it all on one table.

Is there a solution around this? (I'm not opposed to writing XML tools to deal with the complexity if its an option, I'd prefer not to do this dynamic framework through the JDBC if I can avoid it).


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.