Re: Complicated SQL queries

2024-02-07 Thread Christian Gonzalez
I just realized that my issue had to do with my parenthesis, Your solution worked. Thank you so much for the help. On Wed, Feb 7, 2024 at 11:22 AM Jurgen Doll wrote: > Try the following version and see if it works for you: > > ObjectSelect.query( ObjectEntityA.class ) > .columns( >

Re: Complicated SQL queries

2024-02-07 Thread Jurgen Doll
Try the following version and see if it works for you: ObjectSelect.query( ObjectEntityA.class ) .columns( ObjEntityA.PROP_FOR_OBJECT_B .dot( ObjEntityB.PROP_FOR_OBJECT_C ) .dot( ObjEntityC.PROP_FOR_OBJECT_D ) .count() ) .where( ObjEntityA.

Re: Complicated SQL queries

2024-02-07 Thread Christian Gonzalez
One last question, I was trying to update another query using the same method of identifying the wanted columns when trying to fetch from a different ObjectEntity than the one from the ObjectSelect. The issue seems to be that the column I'm selecting is the pk column of another ObjectEntity? The qu

Re: Complicated SQL queries

2024-02-06 Thread Jurgen Doll
> .dot( ObjEntityB.PROP_FOR_OBJ_C ) >> .dot( ObjEntityC.PROP_FOR_OBJ_D ) >> .dot( ObjEntityD.PROP_B ) >> .eq( "somevalue" ) ) >> .select( context ); >> >> Regards >> Jurgen >> >> >> From: Christian Gonzalez &

Re: Complicated SQL queries

2024-02-06 Thread Christian Gonzalez
ss ) > >> .where( ObjEntityE.PROP_FOR_OBJ_A > >> .dot( ObjEntityA.PROP_FOR_OBJ_B ) > >> .dot( ObjEntityB.PROP_FOR_OBJ_C ) > >> .dot( ObjEntityC.PROP_FOR_OBJ_D ) > >> .dot( ObjEntityD.PROP_B ) > >> .eq( "somevalue" ) )

Re: Complicated SQL queries

2024-02-01 Thread Jurgen Doll
ay, 30 January 2024 18:22 To: user@cayenne.apache.org Subject: Re: Complicated SQL queries Sorry for the late follow up, but this query did return the rows I wanted using purely cayenne expressions and object select rather than creating a new objEntity in the model. My last question is if there

Re: Complicated SQL queries

2024-01-31 Thread Christian Gonzalez
> .dot( ObjEntityD.PROP_B ) > .eq( "somevalue" ) ) > .select( context ); > > Regards > Jurgen > > > From: Christian Gonzalez > Sent: Tuesday, 30 January 2024 18:22 > To: user@cayenne.apache.org > Subject: Re: Complicated SQL queries > > S

RE: Complicated SQL queries

2024-01-30 Thread Jurgen Doll
apache.org Subject: Re: Complicated SQL queries Sorry for the late follow up, but this query did return the rows I wanted using purely cayenne expressions and object select rather than creating a new objEntity in the model. My last question is if there is any fast way to convert the returned Array Object

Re: Complicated SQL queries

2024-01-30 Thread Christian Gonzalez
Sorry for the late follow up, but this query did return the rows I wanted using purely cayenne expressions and object select rather than creating a new objEntity in the model. My last question is if there is any fast way to convert the returned Array Objects into the ObjEntity class for ObjectEntit

Re: Complicated SQL queries

2024-01-21 Thread Jurgen Doll
Ahh, my bad again - I missed the whole point of using ObjectSelect somehow, probably because it's difficult to explain without having your model. Anyways here's a shot at it, conceptually the same as what you did in the modeller: List results = ObjectSelect.query( ObjEntityA.class ) .column

Re: Complicated SQL queries

2024-01-19 Thread Christian Gonzalez
Looks like it worked, thank you. It is definitely an interesting way of doing it although I'm not sure about how I feel about having to make a new entity every time a query like this is used but hopefully it won't be too often. Thank you for your help. On Wed, Jan 17, 2024 at 11:08 AM Jurgen Dol

Re: Complicated SQL queries

2024-01-17 Thread Jurgen Doll
Ahh, sorry my bad I didn't see the t0 for tableE. There may be other ways to do it but I think adding t3.varB as an attribute to the object entity might be the simplest. Regards Jurgen

Re: Complicated SQL queries

2024-01-17 Thread Christian Gonzalez
; > t3 has its relationship with t2 on a single variable/attribute and then > > we > > use t3 to evaluate. > > > > Please let me know if there is any additional info you might need. > > > > Thank you, > > Christian Gonzalez > > > > > > O

Re: Complicated SQL queries

2024-01-16 Thread Jurgen Doll
ou might need. Thank you, Christian Gonzalez On Sun, Jan 14, 2024 at 12:33 PM Andrew Lindesay wrote: Hello Christian; Are you able to outline how you have the tables modeled in Cayenne as your question relies on that modelling. Regards. -- Andrew Lindesay On Sat, 13 Jan 2024, at 10

Re: Complicated SQL queries

2024-01-16 Thread Christian Gonzalez
ristian; > > Are you able to outline how you have the tables modeled in Cayenne as your > question relies on that modelling. > > Regards. > > -- > Andrew Lindesay > > On Sat, 13 Jan 2024, at 10:59, Christian Gonzalez wrote: > > Hi, I was wondering if there was a way

Re: Complicated SQL queries

2024-01-14 Thread Andrew Lindesay
Hello Christian; Are you able to outline how you have the tables modeled in Cayenne as your question relies on that modelling. Regards. -- Andrew Lindesay On Sat, 13 Jan 2024, at 10:59, Christian Gonzalez wrote: > Hi, I was wondering if there was a way to perform queries where the end

Complicated SQL queries

2024-01-12 Thread Christian Gonzalez
Hi, I was wondering if there was a way to perform queries where the ending table/class is different from the starting one. I have a query where the result columns (the SELECT part) I want are from a different table than the starting one. It looks something like this: SELECT t3.columnA, t3

Re: Iterate thought all queries, apply template, get raw SQL

2018-11-13 Thread John Huss
m that there are no foreign key > > relationships between your tables? > > > > Yep. This is my primary problem. No doc/FK/relationships in cayenne > mappings. > Guys only did hundreds of queries. > > > > If you have the mapping file, you can always open that map wi

Re: Iterate thought all queries, apply template, get raw SQL

2018-11-13 Thread Alexander Petrossian (PAF)
s in cayenne mappings. Guys only did hundreds of queries. > If you have the mapping file, you can always open that map with the Cayenne > Modeler. It with that you can generate all the SQL for all the schema, of > your database. You can even create a diagram of the database and the > r

Re: Iterate thought all queries, apply template, get raw SQL

2018-11-13 Thread Alexander Petrossian (PAF)
John, this app was not created by me. And I don't have it's source codes. And these people didn't bother to declare FK or relationships in model. And I can't make app to do 100% of queries in mappings. Only few clicks here and there. But thanks for the logging hint! Alexande

Re: Iterate thought all queries, apply template, get raw SQL

2018-11-13 Thread Giaccone, Tony
f Apache Cayenne mappings (2.0), and database is > not documented at all. > > All insights about links between tables (about 2 thousands of tables) I can > get is only from queries found in Cayenne mappings (several megabytes of > those). > > Those tables I can quick analyse with

Re: Iterate thought all queries, apply template, get raw SQL

2018-11-13 Thread John Huss
.petross...@gmail.com> wrote: > Friends, please share your vision. > > I got a project with lots of Apache Cayenne mappings (2.0), and database is > not documented at all. > > All insights about links between tables (about 2 thousands of tables) I can > get is only from queries fo

Iterate thought all queries, apply template, get raw SQL

2018-11-13 Thread Alexander Petrossian (PAF)
Friends, please share your vision. I got a project with lots of Apache Cayenne mappings (2.0), and database is not documented at all. All insights about links between tables (about 2 thousands of tables) I can get is only from queries found in Cayenne mappings (several megabytes of those

Re: Queries with joins and entity qualifiers are broken in cayenne-3.1.2

2017-12-15 Thread Владимир Сухинин
Thank you for fast response. > Qualifiers set via Modeler always use ObjPath so this was a rare case to met. By the way, how it works if column and related field have different names?

Re: Queries with joins and entity qualifiers are broken in cayenne-3.1.2

2017-12-15 Thread Nikita Timofeev
Hi Vladimir, Thanks for information, it was really helpful. I've found the difference between ObjPath and DbPath and fixed this case in 4.1 branch [1]. Qualifiers set via Modeler always use ObjPath so this was a rare case to met. I'll port this fix for 4.0 and 3.1 branches soon. [1] https://gith

Re: Queries with joins and entity qualifiers are broken in cayenne-3.1.2

2017-12-12 Thread Владимир Сухинин
I hope this information will help you. The problem seems to be somewhere around there: at org.apache.cayenne.access.trans.JoinStack.appendJoinSubtree(Appendable, JoinTreeNode) 178: qualifierTranslator.doAppendPart(dbQualifier); where dbQualifier is our qualifier. It goes down to org.apache.cayen

Re: Queries with joins and entity qualifiers are broken in cayenne-3.1.2

2017-12-12 Thread Andrus Adamchik
Hi Vladimir, This looks like a bug to me. We'll investigate. Andrus > On Dec 12, 2017, at 6:37 AM, Владимир Сухинин > wrote: > > I've found that if I use ExpressionFactory.matchDbExp for > DbEntity.setQualifier, > cayenne use wrong aliases when building

Re: Queries with joins and entity qualifiers are broken in cayenne-3.1.2

2017-12-12 Thread Владимир Сухинин
I've found that if I use ExpressionFactory.matchDbExp for DbEntity.setQualifier, cayenne use wrong aliases when building join queries. And if I use ExpressionFactory.matchExp for DbEntity.setQualifier, cayenne build joins with correct aliases. Using matchExp instead of matchDbExp for DbE

Queries with joins and entity qualifiers are broken in cayenne-3.1.2

2017-12-11 Thread Владимир Сухинин
01100100145) AND (t0.DELETED = 0) ORDER BY UPPER(t0.CUSTOMERLASTNAME) ; Earlier we've used cayenne-3.0RC3, and there queries with same DataMap and qualifiers creates correctly SELECT DISTINCT t0.CUSTOMERID, UPPER(t0.CUSTOMERLASTNAME) FROM CUSTOMER t0 LEFT JOIN CUS

Re: Monitoring long running queries

2016-09-13 Thread Hugi Thordarson
That would be awesome. Most of our heavier queries are SQLTemplate now. - hugi > On 13. sep. 2016, at 19:18, Andrus Adamchik wrote: > > Hah, I didn't even know we had this feature. And it is used in that same > 'logSelectCount' method that I mentioned :) > &g

Re: Monitoring long running queries

2016-09-13 Thread Hugi Thordarson
property. It should be this one > > Constants.QUERY_EXECUTION_TIME_LOGGING_THRESHOLD_PROPERTY > > > > On Tue, Sep 13, 2016 at 1:47 PM Andrus Adamchik > wrote: > >> JDBC_MAX_QUEUE_WAIT_TIME is the max time to wait for connections from >> connection pool, so i

Re: Monitoring long running queries

2016-09-13 Thread Andrus Adamchik
Hah, I didn't even know we had this feature. And it is used in that same 'logSelectCount' method that I mentioned :) It should actually get invoked for all types of queries: SelectQuery, SQLTemplate, ProcedureQuery and all their 4.0 fluent wrappers. Andrus > On Sep 13, 2016

Re: Monitoring long running queries

2016-09-13 Thread John Huss
it wouldn't cancel long-running queries or anything. > > From Hugi's description, all the EOF feature does is conditionally output > some logs on slower queries. While I'd handle that in a UNIX way by > attaching some external watch script to the logs, there's certainl

Re: Monitoring long running queries

2016-09-13 Thread Andrus Adamchik
JDBC_MAX_QUEUE_WAIT_TIME is the max time to wait for connections from connection pool, so it wouldn't cancel long-running queries or anything. From Hugi's description, all the EOF feature does is conditionally output some logs on slower queries. While I'd handle that in a UNIX w

Re: Monitoring long running queries

2016-09-10 Thread Hugi Thordarson
Hi John! Thanks for the reply. I added the following to my server runtime initialization, but it does not seem to affect long running queries in any way? Should I be implementing more logic to handle the actual messages? -- Module m = new Module() { @Override

Re: Monitoring long running queries

2016-09-09 Thread John Huss
Also, this doesn't really work for SQLTemplate queries - it will print the log and the time taken, but the SQL is just "null". Not sure if it works for EJBQL queries. On Fri, Sep 9, 2016 at 9:06 AM John Huss wrote: > You can set the property in the module when creating

Re: Monitoring long running queries

2016-09-09 Thread Ken Anderson
than a specified amount of time to complete. Is there any location where I could plug into Cayenne to do something similar? We’re deploying a reporting system for a large-ish database and I know some queries might be problematic—so I’d like to watch out for this as we deploy. Ch

Re: Monitoring long running queries

2016-09-09 Thread John Huss
re than a specified amount of time to complete. > > Is there any location where I could plug into Cayenne to do something > similar? We’re deploying a reporting system for a large-ish database and I > know some queries might be problematic—so I’d like to watch out for this as > we depl

Monitoring long running queries

2016-09-09 Thread Hugi Thordarson
queries might be problematic—so I’d like to watch out for this as we deploy. Cheers, - hugi // Hugi Thordarson // http://www.loftfar.is/ // s. 895-6688

Re: Controlling data types in result when performing SQLTemplate queries

2016-08-16 Thread Hugi Thordarson
guide/queries.html#sqltemplate > > Andrus > >> On Aug 16, 2016, at 2:36 PM, Hugi Thordarson wrote: >> >> Hi all, >> >> Currently when I run SQLTemplate queries that fetch columns of the type >> “DATE” and “TIME”, results are always mapped to java.

Re: Controlling data types in result when performing SQLTemplate queries

2016-08-16 Thread Andrus Adamchik
Currently when I run SQLTemplate queries that fetch columns of the type > “DATE” and “TIME”, results are always mapped to java.util.Date. I’d love to > be able to map them to LocalDate and LocalTime (as they’re mapped in my > ObjEntities). Can I change how SQLTemplate maps the

Controlling data types in result when performing SQLTemplate queries

2016-08-16 Thread Hugi Thordarson
Hi all, Currently when I run SQLTemplate queries that fetch columns of the type “DATE” and “TIME”, results are always mapped to java.util.Date. I’d love to be able to map them to LocalDate and LocalTime (as they’re mapped in my ObjEntities). Can I change how SQLTemplate maps these columns to

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Andrus Adamchik
Hi Frank, With a few exceptions, to-one relationships can be restored without going to DB. Exceptions are: 1. Shared LRU object cache overflows and throws away some snapshots. 2. Relationship semantics means that target PK can not be fully derived from source snapshot. Try putting a breakpoint

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Frank Herrmann
After digging some more, I think I know what is going on. It is more an result of your second example. object2 = // something that fetches object2 object1 = object2.getObject1(); // trips fault, fetches object1 object2 = // refetch object2 from cache object1 = object2.getObject1(); // trips fault,

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Frank Herrmann
Thanks. That is pretty much our issue. If I do a prefetch however on object1 I everything works as expected. I'll have to dig deeper into our code to see what is going on. On Tue, May 17, 2016 at 2:48 PM, Michael Gentry wrote: > Hi Frank, > > There might still be something more going on here. >

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Michael Gentry
Hi Frank, There might still be something more going on here. When you initially fetch object2 for the first time, the relationship to object1 is a "fault" (assuming you don't prefetch). When you say object2.getObject1(), Cayenne will trigger the fault resulting in a SELECT statement sent to the

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Frank Herrmann
I believe your first example. Here is some clarification. object2 = // something that fetches object2 -- object2 is now in the object cache object1 = object2.getObject1(); // makes a call to the database and fetches object1 -- does not put object1 in the object cache object1 = object2.getObject1()

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Michael Gentry
Hi Frank, I'm a little confused by this part: "If we retrieve Object2 from the database, it is placed in the object cache. Afterwards, if we retrieve Object1 via the getter in Object2, Object1 is not cached. So, every time we make the request for Object1 via the getter, another call is made to th

Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Frank Herrmann
Hello all, I have a question regarding how Cayenne does caching. Right now, if we retrieve an object from the database via Cayenne, it is placed in the object cache. However, in our experience, if we then retrieve another object via the relationship on the first object, it is not cached. A rough

Re: likeIgnoreCase queries and EJBQL

2015-10-13 Thread Hugi Thordarson
Admirable effort and duly noted. I know I’d have loved it if someone did this before me and shared the result, so I’ll keep the Informix-specific stuff separate from everything else and we’ll see if this ends up going far enough to make the DB in question “cayenne compatible”. It’s a reeeaaally

Re: likeIgnoreCase queries and EJBQL

2015-10-13 Thread Mike Kienenberger
We are willing to support older obsolete versions of databases as well as new ones. :) Our Oracle driver code is an example of how we support multiple driver versions. On Tue, Oct 13, 2015 at 11:16 AM, Hugi Thordarson wrote: > I’m not sure how useful my work would be since I’m writing against

Re: likeIgnoreCase queries and EJBQL

2015-10-13 Thread Hugi Thordarson
which DB are we talking about? >>> >>> Ah, well… It’s informix— and an old version at that. So I would probably >>> always have had to create my own DbAdaptor anyway. >>> >>> Cheers, >>> - hugi >>> >>> >>>> >>

Re: likeIgnoreCase queries and EJBQL

2015-10-13 Thread Andrus Adamchik
n old version at that. So I would probably >> always have had to create my own DbAdaptor anyway. >> >> Cheers, >> - hugi >> >> >>> >>> Andrus >>> >>> >>>> On Oct 13, 2015, at 5:31 AM, Hugi Thordarson wrote: >

Re: likeIgnoreCase queries and EJBQL

2015-10-13 Thread Hugi Thordarson
ld version at that. So I would probably > always have had to create my own DbAdaptor anyway. > > Cheers, > - hugi > > >> >> Andrus >> >> >>> On Oct 13, 2015, at 5:31 AM, Hugi Thordarson wrote: >>> >>> Thanks Mike! >>> &

Re: likeIgnoreCase queries and EJBQL

2015-10-13 Thread Hugi Thordarson
> Andrus > > >> On Oct 13, 2015, at 5:31 AM, Hugi Thordarson wrote: >> >> Thanks Mike! >> >> I’m not sure it this is a database plugin problem though. Doing regular case >> insensitive queries works fine, it’s only queries created from EJBQL that

Re: likeIgnoreCase queries and EJBQL

2015-10-13 Thread Andrus Adamchik
about that. BTW, which DB are we talking about? Andrus > On Oct 13, 2015, at 5:31 AM, Hugi Thordarson wrote: > > Thanks Mike! > > I’m not sure it this is a database plugin problem though. Doing regular case > insensitive queries works fine, it’s only queries created from

Re: likeIgnoreCase queries and EJBQL

2015-10-13 Thread Hugi Thordarson
Thanks Mike! I’m not sure it this is a database plugin problem though. Doing regular case insensitive queries works fine, it’s only queries created from EJBQL that fail. Also, the only place in the Cayenne sources I can find a mention of “ucase" is in EJBQLTranslator’s visitUpper(). Pe

Re: likeIgnoreCase queries and EJBQL

2015-10-12 Thread Mike Kienenberger
rm an EJBQLQuery, Cayenne will attempt to use UCASE function in the > resulting SQL and things go awry. > > Can I tell the EJBQL SQL translator to use “upper” rather than “ucase” when > performing these queries? > > Cheers, > - hugi

likeIgnoreCase queries and EJBQL

2015-10-12 Thread Hugi Thordarson
performing these queries? Cheers, - hugi

Re: How to use Join Queries

2015-09-26 Thread Hugi Thordarson
If everything is modeled correctly, your “Person” class should have an “addresses” method that will return a List containing all related addresses. - hugi > On 26. sep. 2015, at 13:20, Dipesh Jain wrote: > > Hii Hugi > I am using Cayenne 3.1. You are assuming correctly. I do have mapped table

Re: How to use Join Queries

2015-09-26 Thread Dipesh Jain
Hii Hugi I am using Cayenne 3.1. You are assuming correctly. I do have mapped table ids but not with foreign key constraint, so I can not use foreign key constraint for mapping. And in this code where are you comparing two entities there is just person class hows it using join with address table.

Re: How to use Join Queries

2015-09-26 Thread Hugi Thordarson
Hi Deepesh! Disclaimer: Note my answer applies to Cayenne version 4.0 (it’s the only version I know and I don’t know the older APIs). I’m assuming you’re new to Cayenne and inherited an existing project. Cayenne maps a database to a java object graph, and using Cayenne you'll usually have a o

How to use Join Queries

2015-09-26 Thread Dipesh Jain
I have searched example for SQL joins using apache cayenne but I found nothing. How can i use selectQuery with Expression for JOINs or I have to use SQLTemplete or EJBQL Query. Like I have a query - " Select p.name, a.address from Person p RIGHT OUTER JOIN Address a ON p.personId = a.personId whe

Re: Traversing relationships in DataRow queries?

2015-04-01 Thread Hugi Thordarson
>> While this doesn’t: >> >> SelectQuery q = SelectQuery.dataRowQuery( SMReceipt.class ); >> q.addPrefetch( SMReceipt.SHOP.getName() ); >> List list = objectContext.select( q ); >> >> Should I file a bug report? > > Very surprising. This should generate a "disjoint" prefetch (i.e. a query #2, >

Re: Traversing relationships in DataRow queries?

2015-04-01 Thread Andrus Adamchik
> On Apr 1, 2015, at 2:59 PM, Hugi Thordarson wrote: > > While this doesn’t: > > SelectQuery q = SelectQuery.dataRowQuery( SMReceipt.class ); > q.addPrefetch( SMReceipt.SHOP.getName() ); > List list = objectContext.select( q ); > > Should I file a bug report? Very surprising. This should gene

Re: Traversing relationships in DataRow queries?

2015-04-01 Thread Hugi Thordarson
>> 1) When fetching data rows, can I limit the set of fields fetched, i.e. is >> there an equivalent to EOF’s EOFetchSpecification.setRawRowKeyPaths( NSArray >> )? > > Not right now. This is doable with EJBQLQuery (it allows to specify > individual columns, aggregate functions, etc). This funct

Re: Traversing relationships in DataRow queries?

2015-04-01 Thread Andrus Adamchik
> 1) When fetching data rows, can I limit the set of fields fetched, i.e. is > there an equivalent to EOF’s EOFetchSpecification.setRawRowKeyPaths( NSArray > )? Not right now. This is doable with EJBQLQuery (it allows to specify individual columns, aggregate functions, etc). This functionality

Re: Traversing relationships in DataRow queries?

2015-04-01 Thread Hugi Thordarson
This is perfect, thank you :). Couple of additional questions though: 1) When fetching data rows, can I limit the set of fields fetched, i.e. is there an equivalent to EOF’s EOFetchSpecification.setRawRowKeyPaths( NSArray )? 2) When specifying the prefetch, why do I have to addPrefetch( A.SOME_

Re: Named Queries and SQL that doesn't fetch mapped objects

2015-01-15 Thread dollj
1) If I have several parameters specified in the SQL and I don't provide values for each in the map I pass in what happens to those values? Bad idea. Raw SQL is not like Expressions where you can omit parameters. A "bare" parameter will remain unparsed in the SQL and will be passed to the DB a

Re: Named Queries and SQL that doesn't fetch mapped objects

2015-01-14 Thread Andrus Adamchik
> 1) If I have several parameters specified in the SQL and I don't provide > values for each in the map I pass in what happens to those values? Bad idea. Raw SQL is not like Expressions where you can omit parameters. A "bare" parameter will remain unparsed in the SQL and will be passed to the D

Named Queries and SQL that doesn't fetch mapped objects

2015-01-14 Thread Tony Giaccone
I have a table that represents log data, and I want to group that data time, by using SQL rather then pulling back 65000 rows and aggregating in the java app. The intent is to look at how many transactions occurred over time in a bucket of transactions. So you might look at the hours worth of tran

Re: Traversing relationships in DataRow queries?

2014-10-31 Thread Andrus Adamchik
If I understand the task correctly, a combination of JOINT prefetching and "data rows" should probably do the trick: SelectQuery query = new SelectQuery<>(A.class); query.addPrefetch(A.SOME_REL.joint()); query.setFetchingDataRows(true); Andrus > On Oct 31, 2014, at 1:14 PM, Hugi Thordarso

Traversing relationships in DataRow queries?

2014-10-31 Thread Hugi Thordarson
Hi all. Once again, I’m looking into migrating to Cayenne from EOF :). One question though: Our code depends heavily on raw row fetching (data rows) that traverses relationships. I haven’t looked much at the Cayenne code, but do you believe adding support for this to Cayenne would be a huge und

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-27 Thread Andrus Adamchik
Great. Sorry I didn't have enough time to dig deeper into this, so my advice on this matter wasn't that helpful. Andrus On Sep 27, 2013, at 5:29 PM, Mike Kienenberger wrote: > I wrote, >>> From what testing I've done so far, the qualifier isn't put on for >&

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-27 Thread Mike Kienenberger
I wrote, >> From what testing I've done so far, the qualifier isn't put on for >> prefetch queries, which leaves me at the same situation as when using >> my datacontext delegate. On Tue, Sep 24, 2013 at 1:48 PM, Andrus Adamchik wrote: > This is bad and is not supp

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-26 Thread Mike Kienenberger
y qualifiers >> >> On Tue, Sep 24, 2013 at 1:48 PM, Andrus Adamchik >> wrote: >>> >>>> From what testing I've done so far, the qualifier isn't put on for >>>> prefetch queries, which leaves me at the same situation as when using &g

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-26 Thread Mike Kienenberger
what testing I've done so far, the qualifier isn't put on for >>> prefetch queries, which leaves me at the same situation as when using >>> my datacontext delegate. >> >> This is bad and is not supposed to happen. Appears to be a bug. I am >> checki

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-24 Thread Mike Kienenberger
Added as Issue CAY-1875 - PrefetchSelectQuery incorrectly applies entity qualifiers On Tue, Sep 24, 2013 at 1:48 PM, Andrus Adamchik wrote: > >> From what testing I've done so far, the qualifier isn't put on for >> prefetch queries, which leaves me at the same situ

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-24 Thread Mike Kienenberger
Great idea! I had forgotten that I could create a separate ServerRuntime now. Yes, that would work fine in my case. The overhead isn't an issue in this particular case. That is one of three cases where I now use DataContextFilter, and definitely the one that I would most like to get rid of a

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-24 Thread Andrus Adamchik
On Sep 24, 2013, at 8:48 PM, Andrus Adamchik wrote: > he "special DataContext" case where the qualifier should be ignored can > probably be handled by starting a separate ServerRuntime, where you can strip > off the qualifiers. For whatever overhead it creates (ideally not much), this > has a

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-24 Thread Andrus Adamchik
> From what testing I've done so far, the qualifier isn't put on for > prefetch queries, which leaves me at the same situation as when using > my datacontext delegate. This is bad and is not supposed to happen. Appears to be a bug. I am checking SelectQueryPrefetchRouterAct

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-24 Thread Mike Kienenberger
>From what testing I've done so far, the qualifier isn't put on for prefetch queries, which leaves me at the same situation as when using my datacontext delegate. And I also have one case where I need to be able to disable the qualifier on a specific entity for a specific datacon

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-24 Thread Mike Kienenberger
ext (like user role)? If > it's the former, you can add a qualifier to affected entities in the Modeler. > > Andrus > > On Sep 24, 2013, at 7:00 PM, Mike Kienenberger wrote: > >> Here's one possible way to add support for intercepting prefetch >> queries. I

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-24 Thread Andrus Adamchik
add a qualifier to affected entities in the Modeler. Andrus On Sep 24, 2013, at 7:00 PM, Mike Kienenberger wrote: > Here's one possible way to add support for intercepting prefetch > queries. I'm not entirely certain it's the best way, but I didn't > see another o

Re: No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-24 Thread Mike Kienenberger
Here's one possible way to add support for intercepting prefetch queries. I'm not entirely certain it's the best way, but I didn't see another obvious point. What I did was to call QueryRouter.willPerformQuery(PrefetchSelectQuery query) before routing the newly-created p

No willPerform(Generic)Query support for prefetching queries in 3.1?

2013-09-23 Thread Mike Kienenberger
All of my tests pass now, but I'm still hitting a few issues for 3.1 that the tests didn't reveal. In previous versions (not sure when it changed), there existed the ability to intercept prefetch queries using DataContextDelegate.willPerformQuery() or willPerformGenericQuery(). Those q

Re: Disabling caching for relationship queries

2013-05-09 Thread Markus Reich
thx, now everything is much clearer :-) 2013/5/9 Andrus Adamchik > In this situation related objects are not fetched by the query (they are > resolved when you read them via getter of MiiPickingcontainer). So there's > no any specific caching/refreshing rules involved. Instead related objects >

Re: Disabling caching for relationship queries

2013-05-09 Thread Markus Reich
thx 2013/5/9 Michael Gentry > You can also use a RelationshipQuery to refresh the objects in a > relationship: > > http://cayenne.apache.org/docs/3.0/relationshipquery.html > > > > On Thu, May 9, 2013 at 4:34 AM, Andrus Adamchik >wrote: > > > In this situation related objects are not fetched b

Re: Disabling caching for relationship queries

2013-05-09 Thread Michael Gentry
You can also use a RelationshipQuery to refresh the objects in a relationship: http://cayenne.apache.org/docs/3.0/relationshipquery.html On Thu, May 9, 2013 at 4:34 AM, Andrus Adamchik wrote: > In this situation related objects are not fetched by the query (they are > resolved when you read th

Re: Disabling caching for relationship queries

2013-05-09 Thread Andrus Adamchik
In this situation related objects are not fetched by the query (they are resolved when you read them via getter of MiiPickingcontainer). So there's no any specific caching/refreshing rules involved. Instead related objects simply stay around as long as their owning MiiPickingcontainer objects ar

Re: Disabling caching for relationship queries

2013-05-08 Thread Markus Reich
e.g. SelectQuery query = new SelectQuery(MiiPickingcontainer.class); query.setQualifier(expression); query.addOrdering(MiiPickingcontainer.MESSTART_PROPERTY, SortOrder.ASCENDING); @SuppressWarnings("unchecked") List containers = ctxt.performQuery(query); return containers;

Re: Disabling caching for relationship queries

2013-05-08 Thread Andrus Adamchik
Which query are we talking about? Could you provide a code sample please. Andrus On May 8, 2013, at 2:37 PM, Markus Reich wrote: > Hi, > > is there a possibility to disable the default cayenne caching mechanism > used to get relational data? > I already set Shared Cache to false and Number of

Disabling caching for relationship queries

2013-05-08 Thread Markus Reich
Hi, is there a possibility to disable the default cayenne caching mechanism used to get relational data? I already set Shared Cache to false and Number of Objects to 0, but it still doesn't work :-( regards Meex

Re: Queries during lost connections

2012-12-28 Thread Mike Kienenberger
ml http://objectstyle.org/cayenne/lists/cayenne-user/2005/04/0053.html I have a Cayenne 1.1 system that I maintain which uses Oracle, and while it may have to fail on two or three queries because of the cycle of errors returned from an Oracle database when the connection is lost, it does recover after abo

Queries during lost connections

2012-12-28 Thread Marek Šabo
Hi all, is there any hook for handling lost connections in Cayenne? My use-case is a system that uses Cayenne with remote database. But when the network is down it still needs to fall-back to set of last known values. I would like to know if Cayenne can let me know somehow that it lost conne

Re: Cross Database Queries

2012-06-21 Thread Gary Jarrel
Thank you Andrus, I was working on it for ages, and then started to run out of time and rewrote the code to do the join in the code rather than the DB as the number of records in each table was not very large. I will give it a try with the schemas in both DataMaps and see how I go. I did have the 2

Re: Cross Database Queries

2012-06-15 Thread Andrus Adamchik
In our case it turned out a relationship query with a join across DataNodes. Since both DBs were on the same server, and such join was supported in theory, it was fixed by specifying schemas for all tables in 2 DataMaps. If the DBs are on different servers and joins are not possible, I guess you

Re: Cross Database Queries

2012-06-14 Thread Andrus Adamchik
Gary, just stumbled on something similar in one of our client projects. Investigating... Stay tuned. Andrus On Jun 12, 2012, at 10:48 AM, Andrus Adamchik wrote: > But what happens inside SelectQuery.route(..)? (the failing query is > SelectQuery, right?). This is where the DataNode to Query

Re: Cross Database Queries

2012-06-12 Thread Andrus Adamchik
But what happens inside SelectQuery.route(..)? (the failing query is SelectQuery, right?). This is where the DataNode to Query mapping logic is, so this is the place to look for clues. Andrus On Jun 6, 2012, at 11:47 AM, Gary Jarrel wrote: > I've been debugging & debugging, and for the life of

Re: Cross Database Queries

2012-06-06 Thread Gary Jarrel
I've been debugging & debugging, and for the life of me I can not find where the fault is, both DataNodes are set correctly, I just can't seem to see what I am missing. :( Any further thoughts?! Gary On Tue, Jun 5, 2012 at 10:41 PM, Gary Jarrel wrote: > Just tried it with an XMLPoolingDataSourc

  1   2   3   >