Re: Multiple addJoin with OR
Hi Ludwig, never done that, but I would suppose you could use criteria.getNewCriterion and use the SqlEnum.JOIN as your comparison. Than use criteria.criterion.or to create an or between the two. See: http://db.apache.org/torque/releases/torque-3.3/runtime/apidocs/org/apache/torque/util/Criteria.html http://db.apache.org/torque/releases/torque-3.3/runtime/apidocs/org/apache/torque/util/SqlEnum.html http://db.apache.org/torque/releases/torque-3.3/runtime/apidocs/org/apache/torque/util/Criteria.Criterion.html Regards, Hidde. - Ludwig Magnusson lud...@itcatapult.com wrote: Hi! I want to create an SQLQuery that combines data from three tables. Right now, my javacode looks like this: Criteria.addJoin(TableA.id, TableB.fk); Criteria.addJoin(TableA.id, TableC.fk); This results in this SQL query: . WHERE TableA.id = TableB.fk AND TableA.id = TableC.fk . However, this is not the result I need. What I need is a query with OR instead of AND, like this: . WHERE TableA.id = TableB.fk OR TableA.id = TableC.fk . I haven't found any way to do this using criteria. Is it possible? /Ludwig -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org For additional commands, e-mail: torque-user-h...@db.apache.org
Re: Antwort: Correct way to getRelatedObjects with each relatedObject reference to this object?
Hi Thomas, as an user / programmer I would expect parent.getChildren().getParent() to return the original parent object. Thus I would agree that it feels natural to set the parent of the children upon retrieval of those children. Regards, Hidde. - Thomas Fischer fisc...@seitenbau.net wrote: The only way to achieve this in general would be modifying the object.vm template which generatates the get${relCol} method. I would believe that the behaviour you describe would make sense generally. Any opinions on that from other people ? By doing this one would increase coupling between objects. Thomas -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org For additional commands, e-mail: torque-user-h...@db.apache.org
Re: SQL TIMESTAMP and Torque java.util.Date mapping.
Hi, criteria.add(TestPeer.EXPIRES, (Object) null, Criteria.ISNULL) doesn't work? Regards, Shinkan wrote: Hi again there ! I have a TIMESTAMP type column in a schema, and the Torque maps it to java.util.Date, which is really convenient most of the time. BUT, I would like to check for this column nullity, SQL point-of-view. That's to say, I have to check that this field, let's call it expires, is NULL Timestamp (00-00- 00:00:00). Trying to compare expires against new Date(0) fails as new Date(0) gives (and that's obvious), the first UNIX timestamp date. I can use New Date(int, int, int, int, int, int) BUT it is deprecated, and I really would like to avoid this. So, how can I build a Criteria to check if my field expires from table test is NULL timestamp (00-00- 00:00:00) ? timeCrit.add( TestPeer.EXPIRES, ?); Thanks in advance ! -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4J + Torque ... gonna drive me mad.
Hi Shinkan, I'm glad to hear you fixed it :-) An application should not output warnings if there is nothing to worry about, I agree. Are you 100% sure that Log4J is configured before anything else happens? I've seen those kind of messages, but mostly because things where being configured / started, or used before Log4J was up and running... B.t.w. if you want to be sure nothing is written to the standard out or err, you can redirect the outputs using System.setErr and System.setOut. This might be a smart thing to do if your running as a deamon? Kind regards, Shinkan wrote: As you say, this don't prevent Log4J from working. But these 2 lines are really annoying as my app is a server app, which is run in background as a daemon on Linux. Thus, they are outputed from System.err, and I can't guarantee that production tasks in production env which will use this server will not require stop on standard error output. Moreover, this is not really reassuring from a server that the firts 2 lines you have talks about WARNING ... :D -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Plural Tables Names
Hi Graham, you can specify the java name of your table in the schema xml. You can specify it using the javaName attribute on the table element. See: http://db.apache.org/torque/releases/torque-3.3/generator/schema-reference.html Kind regards, Graham Stewart wrote: This seems like it would be an FAQ, but I can't find the answer to it anywhere. I have a database where the table names are all plural, but I'd really prefer that my object names were not. Is there any way to have Torque create an class called SiteUser to represent the table site_users. -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: idbroker generates existing ID's
Thanks Adam Alvaro, I use a normal size integer, so I should be save for a while. The case of the table name is a good issue. I have been struggling with MySQL and the id_table for a while. I have checked both databases, but alas, no double id tables. I think I'll fall back to Torque 3.2 for now and see if the problems reoccur. I might be 'blaming' Torque while the problems might be related to some other package:-) Thanks for your input, and I'll keep the list informed if I find anything relevant... Kind regards, -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
idbroker generates existing ID's
Hi all, we're experiencing some weird trouble while using the IDBroker. Two of our sites (one running on MySQL 5.x + Torque 3.3-RC1 and one running on Postgres 8.x + Torque 3.3-RC2) start throwing duplicate key exceptions after running (without problems) for a while. The IDs generated are much lower than the next_id entry in the id_table. When I restart the application the problem is gone, but after a while (days/weeks) it returns. Does anybody know what is going on, or has experienced similar problems? Thanks in advanced, with kind regards, -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque is very slow to do a .copy of an object :( Why?
Hi Alain, does your object have many relations (foreign key constraints)? I just looked into the copy method and I see it does a deep copy, so if you have many relations, or many related entries in your database, these will all be copied into your copy. This might explain why it gets slower when there is more data... Greetz, Hidde. philipina wrote: Hello, I'm using torque to connect to my Mysql database. I'm trying to improve performence of my application and I saw that torque is taking more than 600 ms to execute a command like: - Object1 myCopiedObject1 = myObject1.copy(); - Torque is only slow if I have a lots of data in my DB. I cannot understand this! a copy should only do the work in memory and not access the DB. Why is it soo slow? Any idea to speed-up this copy? Thanks in advance. Alain -- Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque is very slow to do a .copy of an object :( Why?
Hi, sorry, but I think that's what I mean:-) So if you have object1 and object2 which references to object1 and you do a copy on object1 it will also copy and add all object2 instances that refer to object1. It looks like this is recursive, because objects that refer to object2 will probably be copied as well... Hope this helps to explain your slowdown, Hidde. philipina wrote: Hi, One other object has a reference to the object I want to copy but the object I want to copy has no reference (foreign key) to any other object. Alain Hidde Boonstra [Us Media]-2 wrote: Hi Alain, does your object have many relations (foreign key constraints)? I just looked into the copy method and I see it does a deep copy, so if you have many relations, or many related entries in your database, these will all be copied into your copy. This might explain why it gets slower when there is more data... Greetz, Hidde. philipina wrote: Hello, I'm using torque to connect to my Mysql database. I'm trying to improve performence of my application and I saw that torque is taking more than 600 ms to execute a command like: - Object1 myCopiedObject1 = myObject1.copy(); - Torque is only slow if I have a lots of data in my DB. I cannot understand this! a copy should only do the work in memory and not access the DB. Why is it soo slow? Any idea to speed-up this copy? Thanks in advance. Alain -- Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
torque-maven-plugin 3.3-RC1: 'subpackageManager' property - TorqueException
Hi all, I'm using the Maven2 torque plugin to generate my object model. When using the 'subpackageManager' configuration property the generated classes end up in the specified package. However, the field 'DEFAULT_MANAGER_CLASS' in my Base...Manager is missing the specified subpackage. This results in a TorqueException caused by a ClassNotFoundException. I have looked for another property but couldn't find any. Can anybody tell me if I'm missing something, or if this is perhaps a feature of the current version of the generator plugin? Thanks, -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: torque-maven-plugin 3.3-RC1: 'subpackageManager' property - TorqueException
Ok, my bad. It says: protected static final String DEFAULT_MANAGER_CLASS = ${packageManager}.${interfaceName}Manager; in the head, in stead of protected static final String DEFAULT_MANAGER_CLASS = ${package}.${interfaceName}Manager; as in mine. I've already created the issue (TORQUE-81), so feel free to close it as invalid / duplicate:) Thanks greets, Hidde. Greg Monroe wrote: This may actually already be fixed in CVS. It sounds like one of the alternate package usage problems in the templates that I found/fixed right after RC1 was released. -Original Message- From: Thomas Fischer [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 06, 2007 9:09 AM To: Apache Torque Users List Subject: RE: torque-maven-plugin 3.3-RC1: 'subpackageManager' property - TorqueException Hi, this sounds like a bug. could you please open a jira issue ? http://issues.apache.org/jira/browse/TORQUE Thanks in advance, Thomas Hidde Boonstra [Us Media] [EMAIL PROTECTED] schrieb am 06.02.2007 14:26:29: Hi all, I'm using the Maven2 torque plugin to generate my object model. When using the 'subpackageManager' configuration property the generated classes end up in the specified package. However, the field 'DEFAULT_MANAGER_CLASS' in my Base...Manager is missing the specified subpackage. This results in a TorqueException caused by a ClassNotFoundException. I have looked for another property but couldn't find any. Can anybody tell me if I'm missing something, or if this is perhaps a feature of the current version of the generator plugin? Thanks, -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Duke CE 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hidde Boonstra Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: 020 428 68 68 f: 020 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]