On 23/12/2007, at 2:10 PM, Adam Yocum wrote:
> Hi Ari,
>
> How can I execute an arbitrary query like the SHOW query to get the
> map of property names and default values, I like that idea, I just
> don't know how to get a plain query to execute with just a client
> app. The client has not db driver lib. Can I use Cayenne to
> execute an arbitrary query?
http://cayenne.apache.org/doc/sqltemplate-query.html
But if you can hardcode the choices of default values to just a few
options (such as in the code you posted), then you will not need this.
> Since the method for setting defaults in the db is the same accross
> the database depending only on field type I can put together
> something like the following to initialize objects following our
> rules... still it does not work ROP :( PersistentObject used for
> client seems to have no way to access the metadata like
> CayenneDataObject does, i.e. no getObjEntity()
Yeah, anything you do with this will need to be server side, not in
the client. But lifecycle events work only on the server anyway, and
only once you've committed the object from the client. The code you
posted could go into the common superclass for your persistent objects
on the server. Catch the lifecycle event (either preUpdate or
prePersist) and fire off your code.
http://cayenne.apache.org/doc/lifecycle-callbacks.html
Ari Maniatis
-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001 fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
This archive was generated by hypermail 2.0.0 : Sat Dec 22 2007 - 23:06:05 EST