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: Mapping problem, structure remake?
PostPosted: Tue Aug 12, 2008 4:04 pm 
Newbie

Joined: Tue Aug 12, 2008 3:47 pm
Posts: 2
Location: Sweden
Hi,

I have a mapping problem with a database setup. I have a table where two columns makes the key. First and ID that comes from another table with an auto increment key, secondly a tinyint (0,1). Together I would like these ones to be the key for my table.

My mapping-file key looks like this:
Code:
<composite-id>
   <key-many-to-one name="Page" column="PageID" class="Objects.Page" />
   <key-property name="IsPublic" column="IsPublic" type="Boolean" length="1" />
</composite-id>


Here, Page is another object that contains and the ID (I have tried with just an integer too). But I can't get this to work for me. Have I misunderstood something when it comes to composite-ids? I know I have to set both the values.

I have also thought about if I should redo my database setup? Can I use the same class but with two different database tables? In that case the two posts could go in two different tables, instead of using the boolean value. Would that be something to prefer?

Hope this makes sense.

Also, I am using MySQL if that matters.


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.