How to persist every new entity?
        Posted  
        
            by simpatico
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by simpatico
        
        
        
        Published on 2010-05-20T21:39:20Z
        Indexed on 
            2010/05/20
            21:40 UTC
        
        
        Read the original article
        Hit count: 229
        
jpa
|entitymanager
I expect every instantiated entity to correspond to a tuple (& co) in the database. In the examples I see around, one always instantiates the entity (via a constructor) and then calls persist with that entity. I find this error-prone, and was wondering if it wasn't possible to have every instantiated entity automatically managed/persisted/reflected to the database (at least intended to).
This also seems to prevent me from persisting instance variable entities. I.e. I've an entity which instantiates another (entities it has an association with) in its constructor.
© Stack Overflow or respective owner