Re: Data base externally modified

2011-09-01 Thread Gary Jarrel
I'd say that would be cache related, as Cayenne is caching the data from the database, switch the cache of in the Modeler perhaps and that should fix your problem. G On Fri, Sep 2, 2011 at 3:04 AM, Anthony Brew wrote: > Hi, >    I have a two processes one which writes to a several database table

Re: External Database Modification

2011-09-01 Thread Andrus Adamchik
There are a few ways of doing it. My favorite is to use SelectQuery's with caching enabled, and OSCache as a cache provider: http://cayenne.apache.org/doc/query-result-caching.html Then you assign each query a cache group String, and configure expiration policies for each cache group. Finally t

Re: Using two different DBs

2011-09-01 Thread Andrus Adamchik
You are welcome. Certainly keep asking questions if you have more :-) On Sep 1, 2011, at 2:47 PM, Richard Frovarp wrote: > Thanks for the ideas. I haven't had a chance to do much with Cayenne since we > talked at ApacheCon last year. But what I have done with it I like very much. > > Richard

Re: Using two different DBs

2011-09-01 Thread Richard Frovarp
On 08/30/2011 04:09 PM, Andrus Adamchik wrote: Hi Richard, To avoid copy/pasting, you can probably start 2 Cayenne stacks. If you are on Cayenne 3.0, this will be 2 Configuration objects and you can add a correct DataNode via API to each stack. In 3.1 it is a bit more elegant. In 3.1M2 2 stac

Re: Test & Set business logic using synchronized blocks

2011-09-01 Thread Andrus Adamchik
Synchronizing on a DataObject is not going to help across contexts as each context has its owen copy of an object. But you can create your own arbitrary lock object of course that is shared between all threads. If this has to be per-object lock, you may try using objects from a single shared Obj

External Database Modification

2011-09-01 Thread Anthony Brew
Hi, I have a two processes one which writes to a several database tables (a ruby on rails application) and a java application that reads the state these data base tables using Cayenne and writes to other tables. When the ruby modifies the underlying data-base I am seeing that Cayenne is not au

Data base externally modified

2011-09-01 Thread Anthony Brew
Hi, I have a two processes one which writes to a several database tables (a ruby on rails application) and a java application that reads the state these data base tables using Cayenne and writes to other tables. When the ruby modifies the underlying data-base I am seeing that Cayenne is not au

Re: ClassCastException with SQLResult and SQLTemplate

2011-09-01 Thread Sylwia Bugla
OK. Got it! I removed the SQLResult and than cast the Objects to DataRow: String sql = "SELECT a.author_id X, count(*) CNT FROM `publication_authors` a WHERE a.`cid` != 0 and a.cid = 1234 group by a.author_id ORDER BY a.`cid` ASC"; SQLTemplate query = new SQLTemplate(PublicationAu

Re: What JSON library are you using with cayenne?

2011-09-01 Thread Christian Grobmeier
Hello David, On Thu, Sep 1, 2011 at 4:00 PM, Pipes, David wrote: > What are you all using for your JSON library with cayenne? I am looking for > some feedback on what works well out of the box or with little work. I can't > seem to find a good JSON library that works well with cayenne and db2 o

Re: ClassCastException with SQLResult and SQLTemplate

2011-09-01 Thread Andrus Adamchik
Ah got it, the exception is in your code, not the Cayenne code. Your SQLResult defines the result as Object[], so this is what you are getting here. You can either keep casting to Map and remove the SQLResult code. Or keep using SQLResult and cast to Object[] Andrus On Sep 1, 2011, at 9:40 AM

What JSON library are you using with cayenne?

2011-09-01 Thread Pipes, David
What are you all using for your JSON library with cayenne? I am looking for some feedback on what works well out of the box or with little work. I can't seem to find a good JSON library that works well with cayenne and db2 on an as400. My initial research pointed me to GSON (Google JSON library)

Re: ClassCastException with SQLResult and SQLTemplate

2011-09-01 Thread Sylwia Bugla
The exception stack is nothing more then: Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.Map on the line: Map dr = (Map) o; I thought that if the SQLTemplate is setted to a Persistent object (PublicationAuthors.class in this case) than the

Re: ClassCastException with SQLResult and SQLTemplate

2011-09-01 Thread Sylwia Bugla
The exception stack is nothing more then: Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.Map on the line: Map dr = (Map) o; I thought that if the SQLTemplate is setted to a Persistent object (PublicationAuthors.class in this case) than the

Re: ClassCastException with SQLResult and SQLTemplate

2011-09-01 Thread Andrus Adamchik
Could you please post the exception stack trace? On Sep 1, 2011, at 1:58 AM, Sylwia Bugla wrote: > Hello everyone. > I am getting desperate about this issue. I have a simple piece of code > whose purpose is to make some counts in the database. It goes like > this: > > String sql = "SELECT a.auth