Re: How can I get the description of a table field, or field from CayenneObject

2012-02-09 Thread Aristedes Maniatis
On 9/02/12 8:50 PM, atomix wrote: Thank a lot Aristedes and Andrus You both point me very good directions which I don't know before. Cheer, this should really be written somewhere in the documentation! You mean the page in the documentation which I linked you to? @Aristedes : Now assume we

Re: HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread atomix
Thank so much for your help! You saved my day! I have some more question in the WebApp area, but may be is should be in another Topic. Again, THANK ! And wish you the best ! -- View this message in context: http://cayenne.195.n3.nabble.com/HOW-TO-Creating-a-SelectQuery-has-Expression-like-thi

Re: HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread Andrus Adamchik
Ah, you found it yourself :) See my other message explaining chaining expressions outside and inside the SelectQuery. On Feb 9, 2012, at 1:56 PM, atomix wrote: > > Expression qual = ExpressionFactory.matchExp("toTestresult", aTestresult); > //qual.andExp(Expression.fromString("get

Re: HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread Andrus Adamchik
Ok, am seeing a common error - Expression.andExp creates a new expression, instead of appending to an existing one (unlike SelectQuery.andQualifier, which doesn't create a new SelectQuery .. I know this can be confusing). So this: > Expression qual = ExpressionFactory.matchExp("t

Re: HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread atomix
Expression qual = ExpressionFactory.matchExp("toTestresult", aTestresult); //qual.andExp(Expression.fromString("getToAnswer.status = status")); //qual.andExp(Expression.fromString("status = 1")); query.andQualifier(Expression.fromString("toAnswer.status = status")); query.andQuali

Re: HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread atomix
GENERATED QUERY : INFO - QueryLogger- SELECT t0.idTestResultAnswer, t0.status, t0.value, t0.idAnswer, t0.idTestResult FROM testresultanswer t0 WHERE t0.idTestResult = ? [bind: 1->idTestResult:9] INFO - QueryLogger- === returned 4 rows. - took 0 ms. return 4;

Re: HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread atomix
I don't have the orginal source code here but here is a similar code : Testresultanswer is the result of an Answer which User fill; Testresultanswer has RelationShip toAnswer Testresult has (some) Testresultanswer Testresultanswer has RelationShip toTestresult Answer.status = 1 (correct Answer)

Re: HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread Andrus Adamchik
On Feb 9, 2012, at 12:58 PM, atomix wrote: > "hit = toOldBook.hit" (Wrong) This should work. Could you show how you build your entire query and what SQL Cayenne generate in the logs? Andrus

Re: HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread atomix
Yes, they have 1-n relationship "toOldBook", I tested "book.hit = toOldBook.hit" (Wrong) "Book.hit = toOldBook.hit" (Wrong) "hit = toOldBook.hit" (Wrong) but "toOldBook.hit = 1" ( Correct) weird "toOldHell = 1" (nothing name to oldHell of course) the query still run without any exception???

Re: How can I get the description of a table field, or field from CayenneObject

2012-02-09 Thread atomix
Thank a lot Aristedes and Andrus You both point me very good directions which I don't know before. Cheer, this should really be written somewhere in the documentation! @Aristedes : Now assume we can use cgen Template to generate some other Class to suite our need (Japser intergration), are you an

Re: HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread Andrus Adamchik
> so I used Expression.fromString("Book.hit = OldBook.hit"); You are on the right track with this, but you need to get your path's right. Aside from using aliases which is a separate topic, the general concept of expression paths is "they all must be relative to the root entity of the SelectQue

Re: How can I get the description of a table field, or field from CayenneObject

2012-02-09 Thread Andrus Adamchik
On Feb 9, 2012, at 12:30 PM, Aristedes Maniatis wrote: >> Hi all, I was quite new with Cayenne, how can I do this : >> >> Book extends _Book >> >> public static final String DESCRIPTION_PROPERTY = "description"; >> public static final String ID_BOOK_PROPERTY = "idBook"; >> public st

HOW TO : Creating a SelectQuery has Expression like this?

2012-02-09 Thread atomix
I have another question regarding Expression in Cayenne : I want my generated SQL like so : *SELECT ** *FROM *Book B1 *JOIN *OldBook B2 *ON *B1.id= B2.id *WHERE *B1.hit = B2.hit so I used Expression.fromString("Book.hit = OldBook.hit"); ... but it's not affect anything to the generated SQL, e

Re: How can I get the description of a table field, or field from CayenneObject

2012-02-09 Thread Aristedes Maniatis
On 9/02/12 8:21 PM, atomix wrote: Hi all, I was quite new with Cayenne, how can I do this : Book extends _Book public static final String DESCRIPTION_PROPERTY = "description"; public static final String ID_BOOK_PROPERTY = "idBook"; public static final String LEVEL_PROPERTY = "lev

How can I get the description of a table field, or field from CayenneObject

2012-02-09 Thread atomix
Hi all, I was quite new with Cayenne, how can I do this : Book extends _Book public static final String DESCRIPTION_PROPERTY = "description"; public static final String ID_BOOK_PROPERTY = "idBook"; public static final String LEVEL_PROPERTY = "level"; public static final String PAT