At 11:27 AM 11/14/2002 +0800, yadan wrote:
>Please give me a example of how to do the insert operation,Thanks!
>And where could I find more example using cayenne?
Hi yadan,
Normally you do not need an explicit query manipulation for that. Just like
our command line tutorial example goes here:
http://objectstyle.org/cayenne/tutorials/cayenne-cmd-app/java/test/Main.java
you would do the operations at the *object* level. For example:
// create new Artist object - it is ready to become persistent
// but it is not in the database yet
Artist dali = (Artist)ctxt.createAndRegisterNewObject("Artist");
// manipulate object attributes
dali.setArtistName("Salvador Dali");
// commit to the database - this is what saves an object to the
database
// Notice - no explicit use of INSERT, Cayenne takes care of it.
// using high enough log level to show the query execution
ctxt.commitChanges(Level.WARN);
Let me know if this answers your question.
Also, I agree that we need to expand the documentation with many more
examples. Maybe just write a bigger Cayenne application showing many
possible scenarios. In the meantime use our tutorials at
http://objectstyle.org/cayenne/userguide/quickstart/index.html , and feel
free to ask questions on this list.
Andrus
This archive was generated by hypermail 2.0.0 : Thu Nov 14 2002 - 00:18:01 EST