Hi,
my problem is that I do not how/where to start with hibernate
and the following setup:
We have a mysql legacy database. In it there are some tables
that have a composite key.
for instance:
myID : unsigned integer, not null, auto_increment
appoved: boolean, not null
data: varchar(200)
someMoreData: varchar(100)
...
the primary key is actually (myID, approved).
The setup is a follows:
data is submitted or updated and comes in a approved=false state
record. All the while the data in the approved=true record (on an
update) is still the same.
Then another user reviews the data and approves it, upon which
the object is again persisted into the approved=false state and
also updated (or inserted) in the approved=true record.
My question is actually:
how to map such a construction? Are there some interfaces to
implement on the pojo's? specific classes? methods?
And for the persisting ... how to do it easily if it can be done at all?
It is a demand that at any one time, there is only 0,1,2 records
with a certain myID inside the table.
kind regards,
Dimitri Smits
aka gongo
|