• Post Reply Bookmark Topic Watch Topic
  • New Topic

Design question - long transaction  RSS feed

 
avihai marchiano
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

My client is a swt client that runs on machine A and the server is a J2ee server that runs on machine B.
We use facade design pattern and the API are exposed to the client as a stateless session bean.

The user does some configuration changes.
for change (like add new components ... ) we need to go to the server in order to create or edit the component (the client doesn't have the knowledge how to do this)
in the end of the configuration process the user may press on the persist button and all the changes need to be persist.

The concept that i need to implement is similar to the concept of editing word document all the changes are saved in temporal document until the user click on save or close the document.

As I see it I need long transaction here, but stateless doesn't support in long transaction and there are a lot of problems (time out and etc) in a long transaction.
I have to save those "temporal configurations" to the DB, because I need to get id for these configurations and other operations.

Does any one have an idea how to implement it?

It is important to remember that if the user edit an existing component other user don't see those changes unless he press on the save button. This scenario can lead to conflict.

Thank you.
Any idea will be welcomed.
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see the need for a long transaction.

They start with a new Object, do their changes and when they click save, that is when a call to the Stateless Session bean occurs, and then you start your transaction and save it. The objects while on the client are just detached objects, not needed to be in a transaction. Your Temporal stuff should be like a cache, just an object witht he information ready to be sent to the server.

Mark
 
avihai marchiano
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that i need an id to the object in order to manage the relation between objects.
So, when a new objcet is created the server create it store it in the DB and have an ID of the object. in this way i can manage another objects that has relation (fk ) with this object.

Thank you
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using an ORM product, you donn't have to get FKs and PKs assigned to handle relationships, when you got to actually save everything in the end, that is when they get assigned.

Mark
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!