Updating totals in a multi-user environment

2014-10-30 Thread Mark Stobbe
Hi all, I was wondering what is the best way to update totals in a multi-user environment. For example, let's say we have an Order which can have one or more Packages associated and we want to maintain a total package count on the Order entity. How would you update this value when the user has

Re: Updating totals in a multi-user environment

2014-10-30 Thread Michael Gentry
Hi Mark, Is there a performance reason why you don't just do a count on the packages that match the order? mrg On Thu, Oct 30, 2014 at 11:00 AM, Mark Stobbe markstobb...@gmail.com wrote: Hi all, I was wondering what is the best way to update totals in a multi-user environment. For example,

Re: Class generation in 3.2.M2-SNAPSHOT

2014-10-30 Thread Andrus Adamchik
Should be fixed on master per https://issues.apache.org/jira/browse/CAY-1964 If you were successful compiling Cayenne, appreciate if you could assemble the latest code and confirm the fix. Andrus On Oct 30, 2014, at 9:46 AM, Andrus Adamchik and...@objectstyle.org wrote: I just spotted a

Re: Updating totals in a multi-user environment

2014-10-30 Thread Mark Stobbe
Hi Michael, I would like to display the count in a table for a whole bunch of orders. In theory I could use a group by-query to get the numbers I need and with proper configured indices this should be fairly quick, I guess. Is there a more transparent way of doing things, e.g. using lifecycle

Re: Updating totals in a multi-user environment

2014-10-30 Thread Mark Stobbe
Oh, I also have the same problem with total cost with different currencies... On Thu, Oct 30, 2014 at 5:09 PM, Mark Stobbe markstobb...@gmail.com wrote: Hi Michael, I would like to display the count in a table for a whole bunch of orders. In theory I could use a group by-query to get the

Re: Updating totals in a multi-user environment

2014-10-30 Thread Andrus Adamchik
Is there a more transparent way of doing things, e.g. using lifecycle listeners, datachannel filters and such? If you want the update to happen on commit, you can use a PostPersist/PostRemove listener on Package. And perhaps update the count with raw SQL to avoid a race condition between

Re: Updating totals in a multi-user environment

2014-10-30 Thread Michael Gentry
Hi Mark, In general I don't like storing data that is easily calculated from the DB itself. (Although I've made exceptions when it was computationally expensive and impractical to do the calculation.) Some options you could try: * Fetch a fresh order and then: order.getPackages().size(). *

Re: Class generation in 3.2.M2-SNAPSHOT

2014-10-30 Thread Lon Varscsak
Awesome, I had discovered both of these bugs last night...but hadn't tackled trying to fix them. Glad someone better equipped to do it jumped in. :) I've confirmed it's working...thanks for the quick response! -Lon On Thu, Oct 30, 2014 at 8:32 AM, Andrus Adamchik and...@objectstyle.org wrote:

Re: Cayenne Modeler

2014-10-30 Thread John Huss
On the ObjEntity screen pressing Sync button (the one with the two arrows will create any missing ObjAttributes from DbAttributes. But primary key / foreign key fields have to be added to the ObjEntity manually. You could uncheck the pk box and then sync, then check it again, but that's probably

Re: Updating totals in a multi-user environment

2014-10-30 Thread Michael Gentry
Hi Mark, Here is the code I mentioned if you want to try it (again, 3.0.2 -- might need tweaked for 3.1): Actual utility code: https://github.com/mrg/cbe/blob/master/FetchingObjects/Aggregates/src/main/java/cbe/fetching/utilities/AggregateUtils.java

Re: Cayenne Modeler

2014-10-30 Thread Michael Gentry
We are really discouraging meaning PKs, Lon. :-) John's advice is as good as it gets, I think. mrg On Thu, Oct 30, 2014 at 8:35 PM, Lon Varscsak lon.varsc...@gmail.com wrote: Hey guys...I think I'm using up all of my question credits quickly. :P Is there a quick way to tell the modeler

Cayenne+jasper reports

2014-10-30 Thread René Aravena
With cayenne 3.1, as I can get the connection to the database to pass it to jasperreports? René

Re: Cayenne+jasper reports

2014-10-30 Thread Markus Reich
Hi René, yes you can access a connection e.g. public static Connection getConnection() throws Exception { return ((DataContext)getObjectContext()).getParentDataDomain().getDefaultNode().getDataSource().getConnection(); } 2014-10-31 3:30 GMT+01:00 René Aravena rene.arav...@gmail.com:

Re: Cayenne+jasper reports

2014-10-30 Thread Aristedes Maniatis
For many projects you'll put the database connection details into JNDI and have Cayenne and anything else get it from there. Of course you might like to give Jasper a read-only connection. Alternatively we wrote a layer which has Jasper access the data model through Cayenne. A bit of work, but