Re: DataContexts mixed

2012-03-30 Thread Aristedes Maniatis
On 31/03/12 3:06 AM, Bruno René Santos wrote: Hello all, I am using now Cayenne 3.1M4 Snapshot and first let me just say that its performance is much better than 3.0.1 (How did you do it? just curious) but I am having a strange problem. I am creating a web application with popups as item detail

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Joe Baldwin
Hi Michael, I just looked up the def of Optimistic Locking and it forwarded me to Optimistic Concurrency Control (so I am not sure of the distinction just yet). But I *think* that the behavior that I have seen in my webapp would be your implementation of optimistic locking. RE: "As for faulti

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Michael Gentry
Hi Joe, It mainly sounds like you care about optimistic locking. Cayenne can use whichever columns you select to test for external changes upon an UPDATE. As for faulting data into memory, Cayenne will get the freshest data the DB has at that point, excluding any pending transactional changes.

DataContexts mixed

2012-03-30 Thread Bruno René Santos
Hello all, I am using now Cayenne 3.1M4 Snapshot and first let me just say that its performance is much better than 3.0.1 (How did you do it? just curious) but I am having a strange problem. I am creating a web application with popups as item details where I use child contexts in order to able to

Re: select over PKs

2012-03-30 Thread Michael Gentry
Hi Sheldon, I guess I don't understand why you can't specify a page size (say 100 or 1000) on your query (unless you are getting the list of PKs from an external source), especially since you want actual Java objects in the end. mrg On Fri, Mar 30, 2012 at 10:45 AM, Sheldon wrote: > Hello Mich

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Joe Baldwin
OK, I am getting confused as to the subject that we are arguing. My interest is specifically with the thesis and conclusion: >>> Cayenne doesn't care about staleness. ... If data isn't available yet, just >>> load it - and accept the risk that the application may now be working with >>> partly

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Andrus Adamchik
Let me try to think how to better present my point. I'll try to get back in a few days. On Mar 30, 2012, at 5:34 PM, Joe Baldwin wrote: > Andrus, > > I am pretty smart, but I have NO idea what you just said, :) I would really > like to understand your argument as it sounds like something tha

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Andrus Adamchik
On Mar 30, 2012, at 5:37 PM, Durchholz, Joachim wrote: >> You have to inflate your cache anew from DB in every transaction. >> You don't have any data when you start. > > Sure, that's unavoidable if you want to do optimistic locking. You can do optimistic locking with cached data just as well.

Re: select over PKs

2012-03-30 Thread Sheldon
Hello Michael, I want to use a SelectQuery (but without using of a String "select ...") Thanks Sheldon -- View this message in context: http://cayenne.195.n3.nabble.com/select-over-PKs-tp3870305p3871032.html Sent from the Cayenne - User mailing list archive at Nabble.com.

Re: select over PKs

2012-03-30 Thread Michael Gentry
Hi Sheldon, Is your list of PKs coming from an external source or are you wanting to use a SelectQuery? Thanks, mrg On Fri, Mar 30, 2012 at 9:28 AM, Sheldon wrote: > Yes I mean primary key. > For example I have a list of primary keys (that should not be random list > keys) and I want to fetch

RE: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Durchholz, Joachim
On Mar 30, 2012, at 5:01 PM, Durchholz, Joachim wrote: >>> Thanks for explaining. If this is so, it sounds... unscalable. >> >> How so? > > You have to inflate your cache anew from DB in every transaction. > You don't have any data when you start. Sure, that's unavoidable if you want to do opti

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Joe Baldwin
Andrus, I am pretty smart, but I have NO idea what you just said, :) I would really like to understand your argument as it sounds like something that might be important to my project. Do you have an analysis somewhere I read up on this? Thanks Joe On Mar 30, 2012, at 10:12 AM, Andrus Adamc

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Andrus Adamchik
On Mar 30, 2012, at 5:01 PM, Durchholz, Joachim wrote: >> Thanks for explaining. If this is so, it sounds... unscalable. > > How so? You have to inflate your cache anew from DB in every transaction. You don't have any data when you start. However I don't think you are right in your assessmen

RE: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Durchholz, Joachim
> Thanks for explaining. If this is so, it this sounds... unscalable. How so? At worst, the memory footprint doubles (plus maybe a logN factor), that sounds pretty scalable to me. ("non-scalable" is "more than NlogN overhead" in my book; I do not know of any substantially better way to implement

RE: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Durchholz, Joachim
>> Cayenne doesn't care about staleness. It's the application's >> task to ensure that Pojo networks are updated to the current >> DB state at the beginning of an application-side transaction. >> If data isn't available yet, just load it - and accept the >> risk that the application may now be work

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Andrus Adamchik
Thanks for explaining. If this is so, it this sounds... unscalable. On Mar 30, 2012, at 4:45 PM, Durchholz, Joachim wrote: >>> Hibernate strictly controls the staleness of objects. If a Session >>> closes, the objects become detached and potentially stale, and >>> there's no way to make the cur

RE: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Durchholz, Joachim
>> Hibernate strictly controls the staleness of objects. If a Session >> closes, the objects become detached and potentially stale, and >> there's no way to make the current again (except by transferring >> their contents to objects of a new Session). Hibernate goes to >> great lengths to protect t

Re: Best Practice Question

2012-03-30 Thread Michael Gentry
Hi Joe, I've never benchmarked/explored it, but my hunch is the number of pages would have to be pretty low (say, less than 3-5). Of course, if you are trying to figure out in-memory vs hit the database again, that logic just adds a bit more complexity to your code and is more to maintain. I thi

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Joe Baldwin
About this comment: On Mar 30, 2012, at 8:56 AM, Durchholz, Joachim wrote: > Cayenne doesn't care about staleness. It's the application's task to ensure > that Pojo networks are updated to the current DB state at the beginning of an > application-side transaction. If data isn't available yet, j

Re: select over PKs

2012-03-30 Thread Sheldon
Yes I mean primary key. For example I have a list of primary keys (that should not be random list keys) and I want to fetch the related objects of these keys. Is this possible? Sheldon -- View this message in context: http://cayenne.195.n3.nabble.com/select-over-PKs-tp3870305p3870799.html Sent f

Re: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Andrus Adamchik
> Hibernate strictly controls the staleness of objects. If a Session closes, > the objects become detached and potentially stale, and there's no way to make > the current again (except by transferring their contents to objects of a new > Session). Hibernate goes to great lengths to protect that

Re: Best Practice Question

2012-03-30 Thread Sheldon
What I mean is, if I have a Table with n columns (col1, col2, col3 ...) and want load only the value ov col1 and col3 (without loading col2 and the others). Is this example possible? Sheldon -- View this message in context: http://cayenne.195.n3.nabble.com/lazy-loading-tp3863908p3870794.html S

Re: Best Practice Question

2012-03-30 Thread Joe Baldwin
OK, good analysis, that makes a lot of sense. So the thing to remember with post-query ordering on large result sets: it is more efficient to re-submit the query to the database. At which point (presumably list size) do you think that orderList() becomes reasonable to use on a result set? Than

RE: lazy loading (slightly OT but still pretty important)

2012-03-30 Thread Durchholz, Joachim
I agree the difference is the approach. Hibernate strictly controls the staleness of objects. If a Session closes, the objects become detached and potentially stale, and there's no way to make the current again (except by transferring their contents to objects of a new Session). Hibernate goes

Re: Best Practice Question

2012-03-30 Thread Michael Gentry
Hi Joe, I think you are on the right path using setPageSize() to limit the result set, but even 50k results is a lot of PKs to return (although not a ludicrous amount, depending on your users). The first approach I would take is if they do a post-query sort then send another query to the database

Re: select over PKs

2012-03-30 Thread Michael Gentry
Hi Sheldon, Like Andrew, I think you meant "primary keys" rather than "private keys". I'm going to guess at what you really are trying to do, but I may fail. :-) You can have Cayenne fetch primary keys only instead of full objects by using a paginated query: http://cayenne.apache.org/doc30/pag

Re: Cayenne with JSF 2

2012-03-30 Thread Andrus Adamchik
Not a JSF user myself, but the use of Cayenne is not that much different between various frontends. You've probably seen the webapp Cayenne tutorial at http://cayenne.apache.org/doc30/tutorial.html You can just follow that on the Cayenne end. You will need to find a similar introductory resource

Re: select over PKs

2012-03-30 Thread Andrew Lindesay
Hi Sheldon; I think you mean "primary keys" rather than "private keys"? I have recently (re)put some material I have written around Cayenne (+more) online; http://www.silvereye.co.nz/lestuff.html You may find something ~similar~ to what you are looking for in; LECayHelper.qu

select over PKs

2012-03-30 Thread Sheldon
Hello, can I fetch data from db with a list of private keys? One possibility is to do this with SQLTemplate and than create a SELECT statement. But I want to do this like: Cayenne.objectForPK(context, Class, List of PKs) Sheldon -- View this message in context: http://cayenne.195.n3.nabble.com/