You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Ludwig Magnusson <lu...@itcatapult.com> on 2010/02/05 11:05:20 UTC

Criteria.or not working?

Hi!

I have done some testing during development of a project here and it seems
that criteria.and([parameters]), criteria.add([parameters]) and
criteria.or([parameters]) all generate the same query to the database.

 

E.g these three code snippets:

Criteria criteria = new Criteria();

criteria.and("user.first_name", "John");

criteria.and("user.last_name", "Doe");

UserPeer.doSelect(criteria);

 

Criteria criteria = new Criteria();

criteria.add("user.first_name", "John");

criteria.add("user.last_name", "Doe");

UserPeer.doSelect(criteria);

 

Criteria criteria = new Criteria();

criteria.or("user.first_name", "John");

criteria.or("user.last_name", "Doe");

UserPeer.doSelect(criteria);

 

. would all generate the Sql query

SELECT * FROM USER WHERE first_name = "John" AND last_name = "Doe";

 

How can this be?

/Ludwig


Re: newbie and generator rewriting

Posted by Ivano Luberti <lu...@archicoop.it>.
I'm guessing if this difference in view come from different experience
or is a matter of skills.

Other comments follow:


Thomas Fischer ha scritto:
>
> Forgive me, but personally I think reverse engineering from the database is
> an inherent pain. You tend to loose important information, e.g.foreign key
> relation (at least using Mysql's MyIsam tables, not so sure for other DBs).
> Also, reverse type mapping can be difficult. In simple cases, you can guess
> the Java type automatically, but you will never get the Torque types
> booleanchar and booleanint back from the DB. And types might be different
> for every supported database. Getting ranges is difficult(can one determine
> that a column is varchar(134) or number(10,2) ? No idea.)
> Then, there's default value, no idea if you get that back. And so on. My
> energy is too limited for this wide field.
>
>   
I have used Torque with postgres and foreign key are supported by
reverse engineering.
More generally I had no issue with data type.
I had some with MySQL, but I consider that server running quickly to
decline (not saying Torque should ceas support, just expressing an
opinion here).
On the contrary using some specific type like booleanchar or booleanint
would let me wonder what is going to happen in the db. And I should
explain it to my DB guys that work on writing triggers and db functions

> The feeling between the Torque developers was that the reverse engineered
> file serves as starting point but must be tweaked manually afterwards. But
> I'm happy to be proven wrong....
>
>   
In this case another field were the project should improve is
documentation about the XML format and how to use that.


>
>> The sql->xml is also useful when you change the db and you want to
>> regenerate the torque classes. How you do that: do you manipulate
>> manually the XML ?
>>     
>
> Yes, and create the alter table script manually. Altering an existing
> database requires good thinking and testing anyway most of the cases, so
> handcoding the SQL is the smallest part.
>
>   
Not sure about "the smallest part" another advantage to make changes
directly in the db is that you prevent data loosing in most cases
(adding column, changinng names.......)
>
>
> Only those two :-) But the old generator is strongly tied to ant which is
> quite pointless for the maven part. It is not a big problem, but the code
> is more complicated and heavy than it has to be.
> In my eyes, the better architecture is to provide the functionality in
> plain java (build-system-agnostic) and provide adapters for the different
> build systems.
>
>   
No doubt.


-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Re: newbie and generator rewriting

Posted by Ivano Luberti <lu...@archicoop.it>.
Ok, Gregg I will read your links...of course I will need some time
Some comments in line


Greg Monroe ha scritto:
>   
>
> I agree TF here. It's hard and will always be wrong for someone or some
> version of SQL.  Remember Torque has to work across all major DB server. 
> But, as TF said, it's a good tool to get a basic snapshot that can be modified 
> to match. IMHO, It's part of the nice rapid application development point of 
> view that Torque has.
>
> FWIW, if you dig into how you would do this, you find that you're dependent 
> on what the JDBC driver returns about the database. If I remember the JDBC 
> specs, the meta data you have to depend on has a lot of "holes" in it as far 
> as finding the underlying DB structure.  Plus, there is a lot of variation 
> in how different drivers implement it.
>
>   
As I wrote answering to TF, using Postgres I didn't find any hole but
maybe I was not using features to expose them.


>
> I think it's important to consider a couple of cases for SQL updates.  The
> first is the major structural changes that requires a lot of testing, etc. 
> as TF talks about above.
>
> The second is case is the additive / minor updates one.  E.g. I've added more 
> tables to  support more features and maybe a few columns to existing tables.  
> This is a much more straight forward change and sql-xml is very useful in this.
>
>   
Exactly

> FWIW, in the latter case, I tend to do is create the SQL build from the 
> *schema.xml that has been checked in.  Create a new DB with tables from it.  
> Do an sql->xml process on the development/test DB and on the new DB.  Compare 
> the two and resolve any "whoops... I added that column to the DB but not the 
> XML. Repeat until they match... (plus keep and eye out for missing FK/Indices).
>
> Then I'll use this XML with the DDLUtils API to create the basic ALTER script.
> It has the ability to do an compare of the real DB to an XML and create a
> nice SQL script.  This isn't perfect, but it's a good start and with some 
> review and quick editing, give me the script to run during the code upgrade.
>
>   
Ah ok: that is a good suggestion. I didn't know about DDL utils api
until TF pointed them to me

> Hope this isn't too confusing since I've been typing on it piece meal over
> the day.
>
>   
I think it is quite clear.
Now I have to make room in my schedule to find time to read your material.
I hope to do next week , but I have two deliveries.

 

==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


RE: newbie and generator rewriting

Posted by Greg Monroe <Gr...@dukece.com>.
More comments in line.. but first, one think to note about 4.0 is that we're 
also planning to convert the XML file format from DTD to XSD.  See:

http://people.apache.org/~gmonroe/torqueSchema/

So when we talk about various tasks needing work, this is part of it.  Oh,
and you might want to read some of the following email threads:

http://www.mail-archive.com/torque-dev@db.apache.org/msg04852.html

http://www.mail-archive.com/torque-dev@db.apache.org/msg04890.html

I think there are some other topics around that same time period as well.

As I said.. more comments in line.

> Thomas Fischer said:
> > > ...
> > > Ah ok, you are using the sql->xml part of the generator ? This is
> indeed an
> > > area where noone else of the torque developers is really interested
> in;
> 
> > May I ask why ? I had guessed that in the past as a user,  but is
> > something I don't understand.
> 
> Forgive me, but personally I think reverse engineering from the database
> is
> an inherent pain. You tend to loose important information, e.g.foreign
> key
> relation (at least using Mysql's MyIsam tables, not so sure for other
> DBs).
> Also, reverse type mapping can be difficult. In simple cases, you can
> guess
> the Java type automatically, but you will never get the Torque types
> booleanchar and booleanint back from the DB. And types might be different
> for every supported database. Getting ranges is difficult(can one
> determine
> that a column is varchar(134) or number(10,2) ? No idea.)
> Then, there's default value, no idea if you get that back. And so on. My
> energy is too limited for this wide field.
> 
> The feeling between the Torque developers was that the reverse engineered
> file serves as starting point but must be tweaked manually afterwards.
> But
> I'm happy to be proven wrong....

I agree TF here. It's hard and will always be wrong for someone or some
version of SQL.  Remember Torque has to work across all major DB server. 
But, as TF said, it's a good tool to get a basic snapshot that can be modified 
to match. IMHO, It's part of the nice rapid application development point of 
view that Torque has.

FWIW, if you dig into how you would do this, you find that you're dependent 
on what the JDBC driver returns about the database. If I remember the JDBC 
specs, the meta data you have to depend on has a lot of "holes" in it as far 
as finding the underlying DB structure.  Plus, there is a lot of variation 
in how different drivers implement it.

Theoretically, I think the SQL standard has definition for a set of system
tables (e.g. SYSCATELOG, etc) that has detailed DB Schema info.  But they
aren't something people strive to keep to standard.  (I think Oracle 
discourages using them...)

That said, there is probably room for improvement here if someone wants 
to dig into it.

> 
> > Is the scenario in which you have to write code for an existing db so
> > unusual?
> 
> For me, it does not happen often. Usually the projects I do is developing
> from scratch.

I've found myself adding Torque objects on top of other people's DB a lot.
In this case, I tend to say "managing the schema" is the other code's job and
Torque's job is just to let my code interact with the data.  In this situation, 
the sql->xml plus a little tweaking can easily produce the "no-sql" objects
I need.  

> 
> > The sql->xml is also useful when you change the db and you want to
> > regenerate the torque classes. How you do that: do you manipulate
> > manually the XML ?
> 
> Yes, and create the alter table script manually. Altering an existing
> database requires good thinking and testing anyway most of the cases, so
> handcoding the SQL is the smallest part.
> 

I think it's important to consider a couple of cases for SQL updates.  The
first is the major structural changes that requires a lot of testing, etc. 
as TF talks about above.

The second is case is the additive / minor updates one.  E.g. I've added more 
tables to  support more features and maybe a few columns to existing tables.  
This is a much more straight forward change and sql-xml is very useful in this.

FWIW, in the latter case, I tend to do is create the SQL build from the 
*schema.xml that has been checked in.  Create a new DB with tables from it.  
Do an sql->xml process on the development/test DB and on the new DB.  Compare 
the two and resolve any "whoops... I added that column to the DB but not the 
XML. Repeat until they match... (plus keep and eye out for missing FK/Indices).

Then I'll use this XML with the DDLUtils API to create the basic ALTER script.
It has the ability to do an compare of the real DB to an XML and create a
nice SQL script.  This isn't perfect, but it's a good start and with some 
review and quick editing, give me the script to run during the code upgrade.

One other benefit of this is that since I run my main app on different 
production machines, it catches / handles the cases where one production server
has been "patched" with a new feature/db setup to meet a client need prior 
to the feature being fully rolled out.  The generated alter script will take
this into account.

I don't think this could ever be fully automated but having the various tools
makes it MUCH more faster to do and less error prone.

> > > we
> > > could use help in that area. In fact, while reorganizing the
> generator
> this
> > > is a part that still needs rewriting (in my opinion, throw out the
> > > ant/texen dependency and create front ends for the different build
> systems.
> > >
> > Different build systems ? What are you thinking about besides ant and
> > maven ?
> 
> Only those two :-) But the old generator is strongly tied to ant which is
> quite pointless for the maven part. It is not a big problem, but the code
> is more complicated and heavy than it has to be.
> In my eyes, the better architecture is to provide the functionality in
> plain java (build-system-agnostic) and provide adapters for the different
> build systems.
> 

Agree... but as a diehard Ant user who only uses Maven if it is required 
(like Torque building and testing...lol)... we should NOT drop Ant 
functionality just for Maven... but I think there is a happy median here
as long as both cases are considered.

> > > Maybe one could also use ddlutils (http://db.apache.org/ddlutils/), I
> did
> > > not check this).
> > I don't know the tool but I have had a look at the web site. In my
> > opinion the integration makes sense if the ddlutils heavily simplify
> the
> > actual code and the tool is widely used (which guarantees is powerful
> > and stable).
> > I see that they last released  it in 2007, quite a long time.
> 
> You are right, there is currently not much traffic there, but I'd guess
> Thomas Dudziak is still around. This was an idea to save double work in
> Torque, but I did not check in detail. For example, I'm not sure that
> ddlutils has maven support... But personally I'd leave that decision to
> the
> person who actually does the work.

I think I was the one who proposed using more of the DDLUtils code in 4.0. 
The thought here was that it does not make sense to have two projects 
doing basically the same thing.  I think we should keep the tasks in 
Torque, but the underlying code should use the DDLUtils API to do the heavy
lifting.

As TF says, there are DDLUtils people around, if we show the need and provide
the code patches to make the two work together, it will get added.  Worst case
is that a Torque committer could make a request to be allowed to commit to the
DDLUtils project (I think we have the rights already, but asking is the proper
way) or maybe request to "adopt" the project if the "owner" has moved on.

Hope this isn't too confusing since I've been typing on it piece meal over
the day.

Greg
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


RE: newbie and generator rewriting

Posted by Thomas Fischer <fi...@seitenbau.net>.
> > ...
> > Ah ok, you are using the sql->xml part of the generator ? This is
indeed an
> > area where noone else of the torque developers is really interested in;

> May I ask why ? I had guessed that in the past as a user,  but is
> something I don't understand.

Forgive me, but personally I think reverse engineering from the database is
an inherent pain. You tend to loose important information, e.g.foreign key
relation (at least using Mysql's MyIsam tables, not so sure for other DBs).
Also, reverse type mapping can be difficult. In simple cases, you can guess
the Java type automatically, but you will never get the Torque types
booleanchar and booleanint back from the DB. And types might be different
for every supported database. Getting ranges is difficult(can one determine
that a column is varchar(134) or number(10,2) ? No idea.)
Then, there's default value, no idea if you get that back. And so on. My
energy is too limited for this wide field.

The feeling between the Torque developers was that the reverse engineered
file serves as starting point but must be tweaked manually afterwards. But
I'm happy to be proven wrong....

> Is the scenario in which you have to write code for an existing db so
> unusual?

For me, it does not happen often. Usually the projects I do is developing
from scratch.

> The sql->xml is also useful when you change the db and you want to
> regenerate the torque classes. How you do that: do you manipulate
> manually the XML ?

Yes, and create the alter table script manually. Altering an existing
database requires good thinking and testing anyway most of the cases, so
handcoding the SQL is the smallest part.

> > we
> > could use help in that area. In fact, while reorganizing the generator
this
> > is a part that still needs rewriting (in my opinion, throw out the
> > ant/texen dependency and create front ends for the different build
systems.
> >
> Different build systems ? What are you thinking about besides ant and
> maven ?

Only those two :-) But the old generator is strongly tied to ant which is
quite pointless for the maven part. It is not a big problem, but the code
is more complicated and heavy than it has to be.
In my eyes, the better architecture is to provide the functionality in
plain java (build-system-agnostic) and provide adapters for the different
build systems.

> > Maybe one could also use ddlutils (http://db.apache.org/ddlutils/), I
did
> > not check this).
> I don't know the tool but I have had a look at the web site. In my
> opinion the integration makes sense if the ddlutils heavily simplify the
> actual code and the tool is widely used (which guarantees is powerful
> and stable).
> I see that they last released  it in 2007, quite a long time.

You are right, there is currently not much traffic there, but I'd guess
Thomas Dudziak is still around. This was an idea to save double work in
Torque, but I did not check in detail. For example, I'm not sure that
ddlutils has maven support... But personally I'd leave that decision to the
person who actually does the work.

    Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


newbie and generator rewriting

Posted by Ivano Luberti <lu...@archicoop.it>.
Hi, as suggested by Thomas I bring this discussion to the dev list.
I'm a newbie so please forgive some clueless observation.

Thomas Fischer ha scritto:
> Ivano ha scritto:
>> ...
>> Unfortunately I'm not familiar with Maven at all but I suspect it is not
>> mandatory to participate in development.
>>     
>
> Hm, you want at least maven2 installed and running otherwise it is quite a
> pain to get the project compiling and building. No deeper knowledge is
> required, of course.
>
>   
Ok I will try to understand how to use it.


>> I have just subscribed the dev mailing list and I will wait before
>> getting code from the rep.
>> I had already made in the past some little modification to the generator
>> providing it the ability to produce xml schemas only for a subset of the
>> tables in a database.
>> I had added to the generator the ability to read from a configuration
>> file to know which tables get metadata for.
>> However I did that on my own and now I read that generator has been
>> changed a lot.
>> ...
>>     
>
> Ah ok, you are using the sql->xml part of the generator ? This is indeed an
> area where noone else of the torque developers is really interested in; 
May I ask why ? I had guessed that in the past as a user,  but is
something I don't understand.
Is the scenario in which you have to write code for an existing db so
unusual?
The sql->xml is also useful when you change the db and you want to
regenerate the torque classes. How you do that: do you manipulate
manually the XML ?


> we
> could use help in that area. In fact, while reorganizing the generator this
> is a part that still needs rewriting (in my opinion, throw out the
> ant/texen dependency and create front ends for the different build systems.
>   
Different build systems ? What are you thinking about besides ant and
maven ?
> Maybe one could also use ddlutils (http://db.apache.org/ddlutils/), I did
> not check this). 
I don't know the tool but I have had a look at the web site. In my
opinion the integration makes sense if the ddlutils heavily simplify the
actual code and the tool is widely used (which guarantees is powerful
and stable).
I see that they last released  it in 2007, quite a long time.

> If new features appear during this development, the better
> (personally I think the exclusion feature is needed often, to exclude
> system tables and views).
>   
Right, in my case I have written a software that uses three different
databases, but two of them are used to import data into the main one.
Import features use only a small subset of the tables of the two dbs, so
no point in generate hundreds of classes when only few of them are used.

> If you are interested in any of that, we should discuss details on the dev
> list.
>
>   
As you see I have started doing it , thanks for your introduction



-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Re: [OT:Torque 4.0] Re: Criteria.or not working?

Posted by Thomas Fischer <fi...@seitenbau.net>.
> Good to hear there is some movement in the Torque ecosystem....
> I have used Torque 3.3 with good satisfaction to develop a web
> application from scratch and I plan, if my company  can fund this
> activities, to port all of my  company software db related under Torque.

:-) Good to hear that other people also like Torque

> I don't know if I'm enough experienced as a developer or DB in
> comparison with Torque team standard but I would like to find a way to
> contribute.
>
> Let me know if this makes sense

The Torque team is happy about anyone willing to contribute. First thing to
to would be to join the dev list, if you have note done so already. This is
where communication about development goals happens.

Next, you need to checkout the torque code locally. Unfortunately,
instructions for the 4.0 branch are not yet online, but the torque4 code is
here: http://svn.apache.org/repos/asf/db/torque/torque4/trunk/
I'll try composing the svn info in the next week or two, so if you are not
familiar with maven2 multiprojects, better wait till this is available.

Then, you need to identify something you would like to work on. Usually
that would be a bug that bothers you or something that you think can be
improved. If you have found something, send a message to torque-dev that
you are willing to work on this and what your plan is. If nobody objects,
start compiling a patch and submit it via jira.

Note that there will be a big change in generator, templates and the maven2
plugin so please wait till this is in svn until you start working in this
area.

Please do ask on the dev list if you have any particular questions.

         Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: [IP Clearance] Db Torque Generator

Posted by Greg Monroe <Gr...@dukece.com>.
Puts on irony hat...

Ah, afraid those of us who know you would see through to your 
Machiavellian plot here and vote against you.  So you're
changing the venue... lol

> -----Original Message-----
> From: Thomas Fischer [mailto:fischer@seitenbau.net]
> Sent: Sunday, February 07, 2010 6:32 AM
> To: Apache Torque Users List
> Subject: RE: [IP Clearance] Db Torque Generator
> 
> oops, wrong list, sorry...
> should have gone to incubator-general...
> 
>    Thomas
> 
> > [IP Clearance] Db Torque Generator
> >
> > I have written a replacement for some DB Torque modules that I would
> like
> > to donate to the ASF.
> >
> > The code base can be found at http://people.apache.org/~tfischer/
> > torque-generator-4-0-proposal.zip, the IP clearance form is available
> at
> > http://incubator.apache.org/ip-clearance/db-torque-generator.html.
> >
> > If anybody thinks it is inappropriate that the person who wrote the
> code
> > also does the IP clearance, please vote -1 and I'll find someone else.
> >
> > The vote closes at Wednesday 10th Feb 18:00 MEZ
> >
> >      Thomas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: [IP Clearance] Db Torque Generator

Posted by Thomas Fischer <fi...@seitenbau.net>.
oops, wrong list, sorry...
should have gone to incubator-general...

   Thomas

> [IP Clearance] Db Torque Generator
>
> I have written a replacement for some DB Torque modules that I would like
> to donate to the ASF.
>
> The code base can be found at http://people.apache.org/~tfischer/
> torque-generator-4-0-proposal.zip, the IP clearance form is available at
> http://incubator.apache.org/ip-clearance/db-torque-generator.html.
>
> If anybody thinks it is inappropriate that the person who wrote the code
> also does the IP clearance, please vote -1 and I'll find someone else.
>
> The vote closes at Wednesday 10th Feb 18:00 MEZ
>
>      Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


[IP Clearance] Db Torque Generator

Posted by Thomas Fischer <fi...@seitenbau.net>.
I have written a replacement for some DB Torque modules that I would like
to donate to the ASF.

The code base can be found at http://people.apache.org/~tfischer/
torque-generator-4-0-proposal.zip, the IP clearance form is available at
http://incubator.apache.org/ip-clearance/db-torque-generator.html.

If anybody thinks it is inappropriate that the person who wrote the code
also does the IP clearance, please vote -1 and I'll find someone else.

The vote closes at Wednesday 10th Feb 18:00 MEZ

     Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: [OT:Torque 4.0] Re: Criteria.or not working?

Posted by Ivano Luberti <lu...@archicoop.it>.
Good to hear there is some movement in the Torque ecosystem....
I have used Torque 3.3 with good satisfaction to develop a web
application from scratch and I plan, if my company  can fund this
activities, to port all of my  company software db related under Torque.

I don't know if I'm enough experienced as a developer or DB in
comparison with Torque team standard but I would like to find a way to
contribute.

Let me know if this makes sense



Thomas Fischer ha scritto:
>> 4.0?
>> I was fearing Torque was a dead project?
>> Any time table?
>>     
>
> Work is under way to rebuild the generator and the templates such that it
> should be mich easier in the future to extend or customize the generated
> code. Work on this is in good progress, so one should be able to try it (at
> least from SVN) in two or three months time scale.
>
> Nothing much has yet happened in the runtime, I fear that discussions about
> how the runtime should look like in the future will be difficult and
> resources are scare, so my personal estimate is a year.
>
>     Thomas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>   

-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


[OT:Torque 4.0] Re: Criteria.or not working?

Posted by Thomas Fischer <fi...@seitenbau.net>.
> 4.0?
> I was fearing Torque was a dead project?
> Any time table?

Work is under way to rebuild the generator and the templates such that it
should be mich easier in the future to extend or customize the generated
code. Work on this is in good progress, so one should be able to try it (at
least from SVN) in two or three months time scale.

Nothing much has yet happened in the runtime, I fear that discussions about
how the runtime should look like in the future will be difficult and
resources are scare, so my personal estimate is a year.

    Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Criteria.or not working?

Posted by Ivano Luberti <lu...@archicoop.it>.
4.0?
I was fearing Torque was a dead project?
Any time table?

Greg Monroe ha scritto:
> Whoops, looked at the code and I think my answer was wrong.  The 
> code is actually behaving as documented.  E.g. the docs say:
>
> "This method adds a new criterion to the list of criterias. If a
>  criterion for the requested column already exists, it is
>  "OR"ed to the existing criterion...."
>
> You are using two different columns in the or statements.  Therefore,
> they are being treated as an add and not an or condition for each
> column.
>
> Not intuitive, but correctly documented. Sigh. Use the criterion 
> method to create mix column or statements.
>
> FWIW, the underlying cause is that criteria object was initially
> created under Java 1.2 or 1.3 and all the Collections interfaces
> where not defined.  So it is based on Hashtable.  This has caused 
> some long term issues like this.  One of the goals of the 4.0 
> version is to replace this with a HashList.  This will allow 
> looking at the last added criterion and applying conditionals to 
> it.  
>
>   
>> -----Original Message-----
>> From: Greg Monroe
>> Sent: Friday, February 05, 2010 9:35 AM
>> To: 'Apache Torque Users List'
>> Subject: RE: Criteria.or not working?
>>
>> I think the proper syntax would be to "add" the left hand operator
>> and then or the conditional with this.  Rather than 2 ors which
>> are right hand conditionals. E.g., the proper syntax would be:
>>
>> Criteria criteria = new Criteria();
>> criteria.add("user.first_name", "John");
>> criteria.or("user.last_name", "Doe");
>> UserPeer.doSelect(criteria);
>>
>> The syntax using two the .or methods is like trying to write an SQL
>> statement like:
>>
>> Select * from user where or user.first='John' or user.last='Doe';
>>
>> The SQL parser would choke on this.  I suspect the code is assuming
>> that since there is no right hand conditional the or should be treated
>> as an and statement. E.g. "Null or X" is translated to just X.   It
>> probably should throw an invalid syntax error here.
>>
>> FWIW, using Criterion is really only "required" if you are using the
>> same column or need parenthetical nesting.
>>
>>
>>     
>>> -----Original Message-----
>>> From: Ivano Luberti [mailto:luberti@archicoop.it]
>>> Sent: Friday, February 05, 2010 9:08 AM
>>> To: Apache Torque Users List
>>> Subject: Re: Criteria.or not working?
>>>
>>> Sorry never tried that, I only now that is not the way the Criteria
>>> class is meant to be used.
>>> So I let developers talk about that.
>>> Alternatively you can dig into the peer classes source code: I have
>>>       
>> done
>>     
>>> a few times to understand Torque behaviour and is quite well written
>>>       
>> and
>>     
>>> readable
>>>
>>> Ludwig Magnusson ha scritto:
>>>       
>>>> Yes that works, but that was not what I asked.
>>>> My question was, how can the methods and(), add() and or() all
>>>>         
>> generate
>>     
>>> the
>>>       
>>>> same result?
>>>>
>>>> -----Original Message-----
>>>> From: Ivano Luberti [mailto:luberti@archicoop.it]
>>>> Sent: den 5 februari 2010 14:10
>>>> To: Apache Torque Users List
>>>> Subject: Re: Criteria.or not working?
>>>>
>>>> If you want to combine clauses mixinn and and or operators you should
>>>> use Criterion.
>>>>
>>>> Look here for an introduction to how build queries using Criteria and
>>>> Criterion
>>>>
>>>> http://db.apache.org/torque/releases/torque-
>>>>         
>> 3.3/runtime/reference/read-
>>     
>>> from-
>>>       
>>>> db.html
>>>>
>>>> Ludwig Magnusson ha scritto:
>>>>
>>>>         
>>>>> Hi!
>>>>>
>>>>> I have done some testing during development of a project here and it
>>>>>           
>>> seems
>>>       
>>>>> that criteria.and([parameters]), criteria.add([parameters]) and
>>>>> criteria.or([parameters]) all generate the same query to the
>>>>>           
>> database.
>>     
>>>>>
>>>>> E.g these three code snippets:
>>>>>
>>>>> Criteria criteria = new Criteria();
>>>>>
>>>>> criteria.and("user.first_name", "John");
>>>>>
>>>>> criteria.and("user.last_name", "Doe");
>>>>>
>>>>> UserPeer.doSelect(criteria);
>>>>>
>>>>>
>>>>>
>>>>> Criteria criteria = new Criteria();
>>>>>
>>>>> criteria.add("user.first_name", "John");
>>>>>
>>>>> criteria.add("user.last_name", "Doe");
>>>>>
>>>>> UserPeer.doSelect(criteria);
>>>>>
>>>>>
>>>>>
>>>>> Criteria criteria = new Criteria();
>>>>>
>>>>> criteria.or("user.first_name", "John");
>>>>>
>>>>> criteria.or("user.last_name", "Doe");
>>>>>
>>>>> UserPeer.doSelect(criteria);
>>>>>
>>>>>
>>>>>
>>>>> . would all generate the Sql query
>>>>>
>>>>> SELECT * FROM USER WHERE first_name = "John" AND last_name = "Doe";
>>>>>
>>>>>
>>>>>
>>>>> How can this be?
>>>>>
>>>>> /Ludwig
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>         
>>> --
>>> ==================================================
>>> dott. Ivano Mario Luberti
>>> Archimede Informatica societa' cooperativa a r. l.
>>> Sede Operativa
>>> Via Gereschi 36 - 56126- Pisa
>>> tel.: +39-050- 580959
>>> tel/fax: +39-050-9711344
>>> web: www.archicoop.it
>>> ==================================================
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: torque-user-help@db.apache.org
>>>       
>> DukeCE Privacy Statement:
>> Please be advised that this e-mail and any files transmitted with
>> it are confidential communication or may otherwise be privileged or
>> confidential and are intended solely for the individual or entity
>> to whom they are addressed. If you are not the intended recipient
>> you may not rely on the contents of this email or any attachments,
>> and we ask that you please not read, copy or retransmit this
>> communication, but reply to the sender and destroy the email, its
>> contents, and all copies thereof immediately. Any unauthorized
>> dissemination, distribution or copying of this communication is
>> strictly prohibited.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: torque-user-help@db.apache.org
>>     
>
> DukeCE Privacy Statement:
> Please be advised that this e-mail and any files transmitted with
> it are confidential communication or may otherwise be privileged or
> confidential and are intended solely for the individual or entity
> to whom they are addressed. If you are not the intended recipient
> you may not rely on the contents of this email or any attachments,
> and we ask that you please not read, copy or retransmit this
> communication, but reply to the sender and destroy the email, its
> contents, and all copies thereof immediately. Any unauthorized
> dissemination, distribution or copying of this communication is
> strictly prohibited.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>   

-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Criteria.or not working?

Posted by Greg Monroe <Gr...@dukece.com>.
Whoops, looked at the code and I think my answer was wrong.  The 
code is actually behaving as documented.  E.g. the docs say:

"This method adds a new criterion to the list of criterias. If a
 criterion for the requested column already exists, it is
 "OR"ed to the existing criterion...."

You are using two different columns in the or statements.  Therefore,
they are being treated as an add and not an or condition for each
column.

Not intuitive, but correctly documented. Sigh. Use the criterion 
method to create mix column or statements.

FWIW, the underlying cause is that criteria object was initially
created under Java 1.2 or 1.3 and all the Collections interfaces
where not defined.  So it is based on Hashtable.  This has caused 
some long term issues like this.  One of the goals of the 4.0 
version is to replace this with a HashList.  This will allow 
looking at the last added criterion and applying conditionals to 
it.  

> -----Original Message-----
> From: Greg Monroe
> Sent: Friday, February 05, 2010 9:35 AM
> To: 'Apache Torque Users List'
> Subject: RE: Criteria.or not working?
> 
> I think the proper syntax would be to "add" the left hand operator
> and then or the conditional with this.  Rather than 2 ors which
> are right hand conditionals. E.g., the proper syntax would be:
> 
> Criteria criteria = new Criteria();
> criteria.add("user.first_name", "John");
> criteria.or("user.last_name", "Doe");
> UserPeer.doSelect(criteria);
> 
> The syntax using two the .or methods is like trying to write an SQL
> statement like:
> 
> Select * from user where or user.first='John' or user.last='Doe';
> 
> The SQL parser would choke on this.  I suspect the code is assuming
> that since there is no right hand conditional the or should be treated
> as an and statement. E.g. "Null or X" is translated to just X.   It
> probably should throw an invalid syntax error here.
> 
> FWIW, using Criterion is really only "required" if you are using the
> same column or need parenthetical nesting.
> 
> 
> > -----Original Message-----
> > From: Ivano Luberti [mailto:luberti@archicoop.it]
> > Sent: Friday, February 05, 2010 9:08 AM
> > To: Apache Torque Users List
> > Subject: Re: Criteria.or not working?
> >
> > Sorry never tried that, I only now that is not the way the Criteria
> > class is meant to be used.
> > So I let developers talk about that.
> > Alternatively you can dig into the peer classes source code: I have
> done
> > a few times to understand Torque behaviour and is quite well written
> and
> > readable
> >
> > Ludwig Magnusson ha scritto:
> > > Yes that works, but that was not what I asked.
> > > My question was, how can the methods and(), add() and or() all
> generate
> > the
> > > same result?
> > >
> > > -----Original Message-----
> > > From: Ivano Luberti [mailto:luberti@archicoop.it]
> > > Sent: den 5 februari 2010 14:10
> > > To: Apache Torque Users List
> > > Subject: Re: Criteria.or not working?
> > >
> > > If you want to combine clauses mixinn and and or operators you should
> > > use Criterion.
> > >
> > > Look here for an introduction to how build queries using Criteria and
> > > Criterion
> > >
> > > http://db.apache.org/torque/releases/torque-
> 3.3/runtime/reference/read-
> > from-
> > > db.html
> > >
> > > Ludwig Magnusson ha scritto:
> > >
> > >> Hi!
> > >>
> > >> I have done some testing during development of a project here and it
> > seems
> > >> that criteria.and([parameters]), criteria.add([parameters]) and
> > >> criteria.or([parameters]) all generate the same query to the
> database.
> > >>
> > >>
> > >>
> > >> E.g these three code snippets:
> > >>
> > >> Criteria criteria = new Criteria();
> > >>
> > >> criteria.and("user.first_name", "John");
> > >>
> > >> criteria.and("user.last_name", "Doe");
> > >>
> > >> UserPeer.doSelect(criteria);
> > >>
> > >>
> > >>
> > >> Criteria criteria = new Criteria();
> > >>
> > >> criteria.add("user.first_name", "John");
> > >>
> > >> criteria.add("user.last_name", "Doe");
> > >>
> > >> UserPeer.doSelect(criteria);
> > >>
> > >>
> > >>
> > >> Criteria criteria = new Criteria();
> > >>
> > >> criteria.or("user.first_name", "John");
> > >>
> > >> criteria.or("user.last_name", "Doe");
> > >>
> > >> UserPeer.doSelect(criteria);
> > >>
> > >>
> > >>
> > >> . would all generate the Sql query
> > >>
> > >> SELECT * FROM USER WHERE first_name = "John" AND last_name = "Doe";
> > >>
> > >>
> > >>
> > >> How can this be?
> > >>
> > >> /Ludwig
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> >
> > --
> > ==================================================
> > dott. Ivano Mario Luberti
> > Archimede Informatica societa' cooperativa a r. l.
> > Sede Operativa
> > Via Gereschi 36 - 56126- Pisa
> > tel.: +39-050- 580959
> > tel/fax: +39-050-9711344
> > web: www.archicoop.it
> > ==================================================
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> 
> DukeCE Privacy Statement:
> Please be advised that this e-mail and any files transmitted with
> it are confidential communication or may otherwise be privileged or
> confidential and are intended solely for the individual or entity
> to whom they are addressed. If you are not the intended recipient
> you may not rely on the contents of this email or any attachments,
> and we ask that you please not read, copy or retransmit this
> communication, but reply to the sender and destroy the email, its
> contents, and all copies thereof immediately. Any unauthorized
> dissemination, distribution or copying of this communication is
> strictly prohibited.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Criteria.or not working?

Posted by Greg Monroe <Gr...@dukece.com>.
I think the proper syntax would be to "add" the left hand operator 
and then or the conditional with this.  Rather than 2 ors which 
are right hand conditionals. E.g., the proper syntax would be:

Criteria criteria = new Criteria();
criteria.add("user.first_name", "John");
criteria.or("user.last_name", "Doe");
UserPeer.doSelect(criteria);

The syntax using two the .or methods is like trying to write an SQL
statement like:

Select * from user where or user.first='John' or user.last='Doe';

The SQL parser would choke on this.  I suspect the code is assuming
that since there is no right hand conditional the or should be treated
as an and statement. E.g. "Null or X" is translated to just X.   It 
probably should throw an invalid syntax error here.

FWIW, using Criterion is really only "required" if you are using the
same column or need parenthetical nesting. 


> -----Original Message-----
> From: Ivano Luberti [mailto:luberti@archicoop.it]
> Sent: Friday, February 05, 2010 9:08 AM
> To: Apache Torque Users List
> Subject: Re: Criteria.or not working?
> 
> Sorry never tried that, I only now that is not the way the Criteria
> class is meant to be used.
> So I let developers talk about that.
> Alternatively you can dig into the peer classes source code: I have done
> a few times to understand Torque behaviour and is quite well written and
> readable
> 
> Ludwig Magnusson ha scritto:
> > Yes that works, but that was not what I asked.
> > My question was, how can the methods and(), add() and or() all generate
> the
> > same result?
> >
> > -----Original Message-----
> > From: Ivano Luberti [mailto:luberti@archicoop.it]
> > Sent: den 5 februari 2010 14:10
> > To: Apache Torque Users List
> > Subject: Re: Criteria.or not working?
> >
> > If you want to combine clauses mixinn and and or operators you should
> > use Criterion.
> >
> > Look here for an introduction to how build queries using Criteria and
> > Criterion
> >
> > http://db.apache.org/torque/releases/torque-3.3/runtime/reference/read-
> from-
> > db.html
> >
> > Ludwig Magnusson ha scritto:
> >
> >> Hi!
> >>
> >> I have done some testing during development of a project here and it
> seems
> >> that criteria.and([parameters]), criteria.add([parameters]) and
> >> criteria.or([parameters]) all generate the same query to the database.
> >>
> >>
> >>
> >> E.g these three code snippets:
> >>
> >> Criteria criteria = new Criteria();
> >>
> >> criteria.and("user.first_name", "John");
> >>
> >> criteria.and("user.last_name", "Doe");
> >>
> >> UserPeer.doSelect(criteria);
> >>
> >>
> >>
> >> Criteria criteria = new Criteria();
> >>
> >> criteria.add("user.first_name", "John");
> >>
> >> criteria.add("user.last_name", "Doe");
> >>
> >> UserPeer.doSelect(criteria);
> >>
> >>
> >>
> >> Criteria criteria = new Criteria();
> >>
> >> criteria.or("user.first_name", "John");
> >>
> >> criteria.or("user.last_name", "Doe");
> >>
> >> UserPeer.doSelect(criteria);
> >>
> >>
> >>
> >> . would all generate the Sql query
> >>
> >> SELECT * FROM USER WHERE first_name = "John" AND last_name = "Doe";
> >>
> >>
> >>
> >> How can this be?
> >>
> >> /Ludwig
> >>
> >>
> >>
> >>
> >
> >
> 
> --
> ==================================================
> dott. Ivano Mario Luberti
> Archimede Informatica societa' cooperativa a r. l.
> Sede Operativa
> Via Gereschi 36 - 56126- Pisa
> tel.: +39-050- 580959
> tel/fax: +39-050-9711344
> web: www.archicoop.it
> ==================================================
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Criteria.or not working?

Posted by Ivano Luberti <lu...@archicoop.it>.
Sorry never tried that, I only now that is not the way the Criteria
class is meant to be used.
So I let developers talk about that.
Alternatively you can dig into the peer classes source code: I have done
a few times to understand Torque behaviour and is quite well written and
readable

Ludwig Magnusson ha scritto:
> Yes that works, but that was not what I asked.
> My question was, how can the methods and(), add() and or() all generate the
> same result?
>
> -----Original Message-----
> From: Ivano Luberti [mailto:luberti@archicoop.it] 
> Sent: den 5 februari 2010 14:10
> To: Apache Torque Users List
> Subject: Re: Criteria.or not working?
>
> If you want to combine clauses mixinn and and or operators you should
> use Criterion.
>
> Look here for an introduction to how build queries using Criteria and
> Criterion
>
> http://db.apache.org/torque/releases/torque-3.3/runtime/reference/read-from-
> db.html
>
> Ludwig Magnusson ha scritto:
>   
>> Hi!
>>
>> I have done some testing during development of a project here and it seems
>> that criteria.and([parameters]), criteria.add([parameters]) and
>> criteria.or([parameters]) all generate the same query to the database.
>>
>>  
>>
>> E.g these three code snippets:
>>
>> Criteria criteria = new Criteria();
>>
>> criteria.and("user.first_name", "John");
>>
>> criteria.and("user.last_name", "Doe");
>>
>> UserPeer.doSelect(criteria);
>>
>>  
>>
>> Criteria criteria = new Criteria();
>>
>> criteria.add("user.first_name", "John");
>>
>> criteria.add("user.last_name", "Doe");
>>
>> UserPeer.doSelect(criteria);
>>
>>  
>>
>> Criteria criteria = new Criteria();
>>
>> criteria.or("user.first_name", "John");
>>
>> criteria.or("user.last_name", "Doe");
>>
>> UserPeer.doSelect(criteria);
>>
>>  
>>
>> . would all generate the Sql query
>>
>> SELECT * FROM USER WHERE first_name = "John" AND last_name = "Doe";
>>
>>  
>>
>> How can this be?
>>
>> /Ludwig
>>
>>
>>   
>>     
>
>   

-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Criteria.or not working?

Posted by Ludwig Magnusson <lu...@itcatapult.com>.
Yes that works, but that was not what I asked.
My question was, how can the methods and(), add() and or() all generate the
same result?

-----Original Message-----
From: Ivano Luberti [mailto:luberti@archicoop.it] 
Sent: den 5 februari 2010 14:10
To: Apache Torque Users List
Subject: Re: Criteria.or not working?

If you want to combine clauses mixinn and and or operators you should
use Criterion.

Look here for an introduction to how build queries using Criteria and
Criterion

http://db.apache.org/torque/releases/torque-3.3/runtime/reference/read-from-
db.html

Ludwig Magnusson ha scritto:
> Hi!
>
> I have done some testing during development of a project here and it seems
> that criteria.and([parameters]), criteria.add([parameters]) and
> criteria.or([parameters]) all generate the same query to the database.
>
>  
>
> E.g these three code snippets:
>
> Criteria criteria = new Criteria();
>
> criteria.and("user.first_name", "John");
>
> criteria.and("user.last_name", "Doe");
>
> UserPeer.doSelect(criteria);
>
>  
>
> Criteria criteria = new Criteria();
>
> criteria.add("user.first_name", "John");
>
> criteria.add("user.last_name", "Doe");
>
> UserPeer.doSelect(criteria);
>
>  
>
> Criteria criteria = new Criteria();
>
> criteria.or("user.first_name", "John");
>
> criteria.or("user.last_name", "Doe");
>
> UserPeer.doSelect(criteria);
>
>  
>
> . would all generate the Sql query
>
> SELECT * FROM USER WHERE first_name = "John" AND last_name = "Doe";
>
>  
>
> How can this be?
>
> /Ludwig
>
>
>   

-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Criteria.or not working?

Posted by Ivano Luberti <lu...@archicoop.it>.
If you want to combine clauses mixinn and and or operators you should
use Criterion.

Look here for an introduction to how build queries using Criteria and
Criterion

http://db.apache.org/torque/releases/torque-3.3/runtime/reference/read-from-db.html

Ludwig Magnusson ha scritto:
> Hi!
>
> I have done some testing during development of a project here and it seems
> that criteria.and([parameters]), criteria.add([parameters]) and
> criteria.or([parameters]) all generate the same query to the database.
>
>  
>
> E.g these three code snippets:
>
> Criteria criteria = new Criteria();
>
> criteria.and("user.first_name", "John");
>
> criteria.and("user.last_name", "Doe");
>
> UserPeer.doSelect(criteria);
>
>  
>
> Criteria criteria = new Criteria();
>
> criteria.add("user.first_name", "John");
>
> criteria.add("user.last_name", "Doe");
>
> UserPeer.doSelect(criteria);
>
>  
>
> Criteria criteria = new Criteria();
>
> criteria.or("user.first_name", "John");
>
> criteria.or("user.last_name", "Doe");
>
> UserPeer.doSelect(criteria);
>
>  
>
> . would all generate the Sql query
>
> SELECT * FROM USER WHERE first_name = "John" AND last_name = "Doe";
>
>  
>
> How can this be?
>
> /Ludwig
>
>
>   

-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org