O'Reilly logo

Java™ Data Objects by Robin M. Roos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.3. Required lifecycle state transitions

Now that we’ve met the different states we can examine the transitions between them. These will each be illustrated with a code snippet that would effect the transition.

4.3.1. Persisting a transient instance

To persist a transient instance, pass it to the makePersistent() method of a PersistenceManager (Figure 4.1). This is essentially a request to create a new entity in the data store. Where application identity is used this request will fail if the primary key already exists in the datastore. With data store identity the entity will be persisted even if another persistent entity already exists with identical persistent field values, as the JDO identities (created by the implementation when each instance ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required