as you can expect, I am a newbe to JPA, and really stuck as well.
I have a requirement for a web app that needs to maintain all versions that have been created.
like having an article's table where every iteration of content changes need to be kept for future reference.
for instance my table might be like:
create table t_articles(
article_id int primary key
, article_content_id int not null
, article_version int not null
, article_published bit
, article_title varchar(64) not null
, article_content_txt varchar(4000)
, created_by int
, created_dt datetime
, valid_until datetime
this table will have a unique index on:
we can have the same article (article_content_id) with multiple revisions (article_version)
and there is also a check to ensure that:
only ONE record article_content_id has article_published set to true (this is the record that will be shown on the webpage)
i imaged that i can be done by creating the correct logic within a method.
but i am not certain about how to control the transactions.
does it mean that i have to change the transaction from being container controlled to be application controlled?