1 Reply Latest reply on Mar 16, 2010 4:18 PM by Ilya Dyoshin

    Using EntitiyHome classes without the related pages?

    Christian Drechsler Newbie

      Hello,


      I'm new to Seam and Java EE, and I'm currently trying to figure out how to best solve the following challenge:


      The project I'm currently working on requires versioning of text snippets that will be incorporated into a text file that has versions, too.


      When a text snippet (an entity) is changed, the entity itself should not be changed, instead a new entity with a stepped-up version number should be created. Moreover, a new version of all text files that contain the snippet must be created where the old version of the snippet is replacded the new version.


      I've never seen any sample code that deals with similar stuff and I'm not sure how to do that properly with Seam.


      First, how do I replace the instance to be displayed on the editing page by another one? Can I just use createInstance() in EntityHome, and the instance displayed will be replaced by the new one on a page reload?


      For creating a new text file instance, I'd instantiate a new Home instance for the text file entity, call getInstance() without setting the id before, fill the instance with the data I need and then call persist(). Is that the right way to go?


      But what about the @In properties that both the text snippet Home class and the text file Home class are using? Will it cause an error to use the classes directly without the pages normally related to them?


      Or should I go a completetly different way and not use the Home classes at all?


      Thanks in advance for any answers,


      Christian