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.