How to integrate Cayenne with non persisting object

From: Galia Yer (galiaye..ahoo.com)
Date: Fri May 21 2010 - 16:44:09 UTC

  • Next message: MGargan..scholar.com: "Blobs in the DataContext"

    Hi to all, I'm evaluation Apache Chayenne in order to insert it into some existing applications. I'd like to ask a suggestion if the use of Chayenne that I'm intending could be correct. In this example I'd like to integrate Cayenne for manage user of a Java application. At the moment, in this application, when I'd like to insert a new user, I run a simple code like: private myUserClass user = new myUserClass (); user.setName("Name"); user.setSurname("Surname"); After that I compute same operation on this user, for example: if testUserValidation(user) { user.insertToDB() } else { // Nothing to do user it’s not inserted into DB. } So the user is inserted into DB, if and only if it pass the validation. Now I'd like to introduce Cayenne so I’ve create my User class and mapped it to a DB using CayenneModeler and all seems to work, my question is how can I complete the task above, in particular how to initializate an empty object without inserting it into DB. In getting started guide I found only this example: Artist picasso = context.newObject(Artist.class); This create a persist object, I'd like to initialize a non persisting object and make it persisting only after some validation or similar conditions. Could you give me some suggestion about? Than you very much! Regard Maurizio



    This archive was generated by hypermail 2.0.0 : Fri May 21 2010 - 16:44:46 UTC