Passing Blobs to stored procedure

2011-09-02 Thread Joseph Senecal
I'm trying to pass a Blob to a stored procedure. The parameter is defined in the CayenneModeler as an IN parameter of type BLOB. I'm passing an array of bytes to ProcedureQuery.addParameter. When the code runs it gets an cast exception "org.apache.cayenne.util.MemoryBlob cannot be cast to oracl

Re: Data base externally modified

2011-09-02 Thread Andrus Adamchik
Another way to refresh an object, including the content of its relationships (but not the contents of the related objects) is this: context.invalidateObjects(Collections.singleton(myObject)); This may be more in line of what you are trying to do. Andrus On Sep 2, 2011, at 1:59 PM, Andrus Adamc

Re: Data base externally modified

2011-09-02 Thread Andrus Adamchik
In general a Cayenne user may be dealing with an object graph that can potentially start at 1 entity and then span the entire DB (prefetches can be multi-step). So Cayenne can't guess for you which relationships need to be refreshed, without potentially incurring a gigantic query. So it is sti

Re: Data base externally modified

2011-09-02 Thread Anthony Brew
Hi Andrus, Yeah thats the most viable solution I have found so far, but tbh but from a code point of view here I think its a risky option as it could introduce bugs, it not all changing properties are added to the prefetch. query.addPrefetch(Item.SUB_ITEMS_PROPERTY); Would be nice

Re: Data base externally modified

2011-09-02 Thread Andrus Adamchik
To refresh a relationship, you may use a prefetch on the query: query.addPrefetch(Item.SUB_ITEMS_PROPERTY); Andrus On Sep 2, 2011, at 12:51 PM, Joseph Senecal wrote: > I think the generated code for the getter() should always return the existing > list because that is the whole point of an O

Re: Data base externally modified

2011-09-02 Thread Joseph Senecal
I think the generated code for the getter() should always return the existing list because that is the whole point of an ORM, to manage an object graph in memory. But it should be easy to override that getter() method in the generated subclass to always do an uncached query. Joe On Sep 2, 201

Re: Data base externally modified

2011-09-02 Thread Mike Kienenberger
There may be a better way, but one obvious way this could be done is to change the code generation so that the getter() executes a select query rather than returning an existing list. On Fri, Sep 2, 2011 at 11:28 AM, Anthony Brew wrote: > Hi, >Just an update, and I think I forgot to include s

Re: Data base externally modified

2011-09-02 Thread Anthony Brew
Hi, Just an update, and I think I forgot to include something important Its a one to many relationship that I am seeing cached, (ie I fetch "Item" and the many to one "Item.getSubItems()" are being fetched from the cache) My code now looks a bit like: Expression e1 = Expression.fromSt

Re: Data base externally modified

2011-09-02 Thread Mike Kienenberger
You may want to review these two threads from the end of July: OSCache is gone http://www.mail-archive.com/dev@cayenne.apache.org/msg06209.html EhCache integration preview http://www.mail-archive.com/user@cayenne.apache.org/msg06211.html On Fri, Sep 2, 2011 at 10:30 AM, Anthony Brew wrote: > H

Re: Data base externally modified

2011-09-02 Thread Anthony Brew
Hi Andrus, I was just about to get back to you on, I accidentally started two threads when I joined the mailing list. Essentially we have a ruby on rails project that creates config on the front end, this is the part that is changing externally. Then internally we read these config

Re: What JSON library are you using with cayenne?

2011-09-02 Thread Christian Grobmeier
Hello > private String getJsonExample(){ >  Gson gson = new Gson(); >  List test = Webdvcr.getDvcrByUnitNum("502"); >  // returns a Webdvcr object that is extended from CayenneDataObject >  return gson.toJson(test); > } > > In this example with GSON it works perfect and this is what I'm trying to

Re: Data base externally modified

2011-09-02 Thread Andrus Adamchik
Could you please explain your data access patterns? E.g. if you fetch some objects and store them in an instance variable in your application, they are not going to get refreshed automatically. To refresh objects you need to either invalidate them explicitly via context.invalidateObjects() or r

Re: Data base externally modified

2011-09-02 Thread Anthony Brew
Hi Gary, Yeah thats what I am seeing in the code, but I cant for the life of me see how to turn off the caching completely in the modeller, I actually think it wont hit our performance very badly to have no caching. The cache setting I see are the in the DataDomain Configuration Which

RE: What JSON library are you using with cayenne?

2011-09-02 Thread Pipes, David
Hello Christian, That's for this information. I downloaded your jjson code and was testing it a bit. I was looking for something that I didn't have to use annotations with (personal dislike or annotations). It seems to work great for the test cases from the source. But I am unable to get it to w