Update stalls

2009-10-08 Thread Sheldon Ross
Is there a way to log peer updates, I'm trying to figure out why a save 
is failing.


The last thing the torque log shows is this.

2009-10-08 16:57:08,248 [TP-Processor3] DEBUG 
org.apache.torque.util.BasePeer - BasePeer.doUpdate: 
whereClause=XX=4433148


It just appears to stall at this point. The application just hangs on 
the obj.save();


--
Sheldon Ross



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



Re: Antwort: Update stalls

2009-10-09 Thread Sheldon Ross
I've tracked it down to a Postgresql connection releasing problem, which 
apparently is known.

The solution mentioned is to use the newer

org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory

rather than

org.apache.torque.dsfactory.SharedPoolDataSourceFactory

But I don't seem to have this Jdbc2PoolDataSourceFactory and I just 
downloaded the latest torque 3.3.


Any thoughts?

Thanks

Thomas Fischer wrote:

Is there a way to log peer updates, I'm trying to figure out why a save
is failing.



People have used p6spy for this. It wraps your db driver and logs all sql.

Thomas


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


  


--
Sheldon Ross


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



Re: Antwort: Update stalls

2009-10-09 Thread Sheldon Ross

Ah found it at last, commons-dbcp, and commons-pool needed to be updated.

Works great now.

Sheldon Ross wrote:
I've tracked it down to a Postgresql connection releasing problem, 
which apparently is known.

The solution mentioned is to use the newer

org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory

rather than

org.apache.torque.dsfactory.SharedPoolDataSourceFactory

But I don't seem to have this Jdbc2PoolDataSourceFactory and I just 
downloaded the latest torque 3.3.


Any thoughts?

Thanks

Thomas Fischer wrote:

Is there a way to log peer updates, I'm trying to figure out why a save
is failing.



People have used p6spy for this. It wraps your db driver and logs all 
sql.


Thomas


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


  




--
Sheldon Ross
Software Development
American Simmental Association
sr...@simmgene.com
(406)587-4531 ext 102 



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



Criteria casting.

2009-10-12 Thread Sheldon Ross

So I have

Criteria subquery = new Criteria();
criteria.add(ThisObjectPeer.COLUMN_A,valueA);
criteria.addSelectColumn(ThisObjectPeer.COLUMN_B);

Criteria criteria = new Criteria();
criteria.add(TheOtherObjectPeer.COLUMN_C,subquery,Criteria.IN);


The only problem is COLUMN_B is an string, and COLUMN_C is an integer. 
Is there any way to add a cast in the subquery, or select column as an 
integer?


The new versions of Postgresql strongly enforce types and won't let you 
compare integer to character varying.


Any thoughts?
Thanks

--
Sheldon Ross
Software Development



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



QueryDataSet constructing takes forever

2009-10-21 Thread Sheldon Ross

Hello,
The following code produces some interesting results in my system.

   connection = Torque.getConnection(Torque.getDefaultDB());
   PreparedStatement statement = 
connection.prepareStatement(dynamicQuery);

   ResultSet set = statement.executeQuery();
   long startTime = System.currentTimeMillis();
   QueryDataSet dataSet = new QueryDataSet(set);
   log.debug("DDAElapsed time="+ (System.currentTimeMillis() - 
startTime) + " ms");

   return BasePeer.getSelectResults(dataSet);

The actual elapsed time of the query is very small, but it seems to take 
a very long time to create the querydataset.


2009-10-21 15:37:06,969 [TP-Processor3] DEBUG 
org.simmental.datamods.utils.DirectDataAccessor - DDAElapsed time=133 ms
2009-10-21 15:37:06,970 [TP-Processor3] DEBUG 
org.simmental.datamods.om.AnmId - Elapsed time=140 ms


The last is the total elapsed time, so It appears to me like it is 
taking ~ 7ms to do the query, but ~133 ms to construct the querydataset.


Anyone experience anything like this?

Thanks

--
Sheldon Ross
Software Development


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



Re: [Torque] Using Torque again

2009-11-09 Thread Sheldon Ross
It would appear that there are significant differences in the 
build.properties file (and/or build-torque.xml) from 1.0 to 3.3.


My suggestion is to redo your old 1.0 build.properties file and make 
sure it is of the proper form for 3.3 and use xml from 3.3


Ross

Angela Day wrote:
I am trying to upgrade from Torque 1.0 to 3.3.  I have replaced all of the jar files 
and made sure my dependencies were covered.  It is an existing application that

was working until I converted, so I know it is finding the project-schema.xml 
file
correctly.  This question is posted on the
internet multiple times, with no solution.  If you can help me out, I
would really appreciate it.


Thanks,
Angela


BUILD FAILED
C:\workspace\contract\build.xml:157: Following error occured while executing thi
s line
C:\workspace\contract\build-torque.xml:503: Following error occured while execut
ing this line
C:\workspace\contract\build-torque.xml:531: Exception thrown by 'properties.load
'. For more information consult the velocity log, or invoke ant with the -debug
flag.
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
tHelper.java:537)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
at org.apache.tools.ant.Main.runBuild(Main.java:632)
at org.apache.tools.ant.Main.startAnt(Main.java:183)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
Caused by: C:\workspace\contract\build-torque.xml:503: Following error occured w
hile executing this line
C:\workspace\contract\build-torque.xml:531: Exception thrown by 'properties.load
'. For more information consult the velocity log, or invoke ant with the -debug
flag.
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
tHelper.java:537)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)

at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:383)
... 10 more
Caused by: C:\workspace\contract\build-torque.xml:531: Exception thrown by 'prop
erties.load'. For more information consult the velocity log, or invoke ant with
the -debug flag.
at org.apache.velocity.texen.ant.TexenTask.execute(TexenTask.java:596)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
  


--
Sheldon Ross
Software Development
American Simmental Association
sr...@simmgene.com
(406)587-4531 ext 102 



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



Re: [Torque] Using Torque again

2009-11-09 Thread Sheldon Ross
From what I understand, in newer versions of torque you should really 
not be editing much in the build-torque.xml itself.


At the top of your file, there should be something like this.





This specifies the properties file torque will use for configuration. 
I'm guessing you either don't have these lines defined correctly, or the 
(in this example) "build.properties" file doesn't exist.



Ross

Angela Day wrote:

Never mind.  I realized I was missing the torque-gen-templates-3.3.jar.  But I 
am still getting the original error:

Exception thrown by 'properties.load'

I have updated all of my jar files and specified them in the build-torque.xml 
file.  I have updated my (project)-build.xml file.  I am not getting any 
complaints about any of these files.  Any Help would be appreciated.

Thanks,

 
Angela Day

National Autism Association of Central Texas

http://www.naacentraltexas.org
formally FEAT Austin






From: Angela Day 
To: Apache Torque Users List 
Sent: Mon, November 9, 2009 3:18:29 PM
Subject: Re: [Torque] Using Torque again

I have been updating the build-torque.xml file and am now getting:

C:\workspace\contract\build-torque.xml:96: taskdef class 
org.apache.torque.task.TorqueDataModelTask cannot be found
I have warning decoration next to all of the taskdefs.  In what jar are these 
classes found?


Thanks,

Angela Day
National Autism Association of Central Texas

http://www.naacentraltexas.org
formally FEAT Austin





____
From: Sheldon Ross 
To: Apache Torque Users List 
Sent: Mon, November 9, 2009 3:00:29 PM
Subject: Re: [Torque] Using Torque again

It would appear that there are significant differences in the build.properties 
file (and/or build-torque.xml) from 1.0 to 3.3.

My suggestion is to redo your old 1.0 build.properties file and make sure it is 
of the proper form for 3.3 and use xml from 3.3

Ross

Angela Day wrote:
  

I am trying to upgrade from Torque 1.0 to 3.3.  I have replaced all of the jar 
files and made sure my dependencies were covered.  It is an existing 
application that
was working until I converted, so I know it is finding the project-schema.xml 
file
correctly.  This question is posted on the
internet multiple times, with no solution.  If you can help me out, I
would really appreciate it.


Thanks,
Angela


BUILD FAILED
C:\workspace\contract\build.xml:157: Following error occured while executing thi
s line
C:\workspace\contract\build-torque.xml:503: Following error occured while execut
ing this line
C:\workspace\contract\build-torque.xml:531: Exception thrown by 'properties.load
'. For more information consult the velocity log, or invoke ant with the -debug
flag.
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
tHelper.java:537)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
at org.apache.tools.ant.Main.runBuild(Main.java:632)
at org.apache.tools.ant.Main.startAnt(Main.java:183)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
Caused by: C:\workspace\contract\build-torque.xml:503: Following error occured w
hile executing this line
C:\workspace\contract\build-torque.xml:531: Exception thrown by 'properties.load
'. For more information consult the velocity log, or invoke ant with the -debug
flag.
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
tHelper.java:537)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)

at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:383)
... 10 more
Caused by: C:\workspace\contract\build-torque.xml:531: Exception thrown by 'prop
erties.load'. For more information consult the velocity log, or invoke ant with
the -debug flag.
at org.apache.velocity.texen.ant.TexenTask.execute(TexenTask.java:596)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
 



-- Sheldon Ross
Software Development
Americ

Re: [Torque] Using Torque again

2009-11-09 Thread Sheldon Ross
Ok, ant uses xml in order to define tasks. These tasks are called 
targets. In my file the target around lines 500-530 are the targets for 
building your OM objects, which I assume you're trying to do.


In those targets are references to files and properties that the target 
needs to execute.


From my xml.

   

The "${torque.contextProperties}" file must be defined and exist (and 
path be right) for this to execute properly If it doesn't you will get 
errors such as you report.


Ross

Angela Day wrote:

No, I just replaced the build-torque.xml file with the one from torque-3.3.zip 
and just made a few little adjustments on the jar files in the classpath.  I 
updated all of my jar files to be at least as high as the dependencies list 
from the torque website.  I updated my xxx-schema.xml to point to the correct 
database_3_3.xml file.  Did I leave anything out?

Thanks,

 
Angela Day

National Autism Association of Central Texas

http://www.naacentraltexas.org
formally FEAT Austin





________
From: Sheldon Ross 
To: Apache Torque Users List 
Sent: Mon, November 9, 2009 3:51:30 PM
Subject: Re: [Torque] Using Torque again

>From what I understand, in newer versions of torque you should really 
not be editing much in the build-torque.xml itself.


At the top of your file, there should be something like this.





This specifies the properties file torque will use for configuration. 
I'm guessing you either don't have these lines defined correctly, or the 
(in this example) "build.properties" file doesn't exist.



Ross

Angela Day wrote:
  

Never mind.  I realized I was missing the torque-gen-templates-3.3.jar.  But I 
am still getting the original error:

Exception thrown by 'properties.load'

I have updated all of my jar files and specified them in the build-torque.xml 
file.  I have updated my (project)-build.xml file.  I am not getting any 
complaints about any of these files.  Any Help would be appreciated.

Thanks,

 
Angela Day

National Autism Association of Central Texas

http://www.naacentraltexas.org
formally FEAT Austin






From: Angela Day 
To: Apache Torque Users List 
Sent: Mon, November 9, 2009 3:18:29 PM
Subject: Re: [Torque] Using Torque again

I have been updating the build-torque.xml file and am now getting:

C:\workspace\contract\build-torque.xml:96: taskdef class 
org.apache.torque.task.TorqueDataModelTask cannot be found
I have warning decoration next to all of the taskdefs.  In what jar are these 
classes found?


Thanks,

Angela Day
National Autism Association of Central Texas

http://www.naacentraltexas.org
formally FEAT Austin






From: Sheldon Ross 
To: Apache Torque Users List 
Sent: Mon, November 9, 2009 3:00:29 PM
Subject: Re: [Torque] Using Torque again

It would appear that there are significant differences in the build.properties 
file (and/or build-torque.xml) from 1.0 to 3.3.

My suggestion is to redo your old 1.0 build.properties file and make sure it is 
of the proper form for 3.3 and use xml from 3.3

Ross

Angela Day wrote:
 


I am trying to upgrade from Torque 1.0 to 3.3.  I have replaced all of the jar 
files and made sure my dependencies were covered.  It is an existing 
application that
was working until I converted, so I know it is finding the project-schema.xml 
file
correctly.  This question is posted on the
internet multiple times, with no solution.  If you can help me out, I
would really appreciate it.


Thanks,
Angela


BUILD FAILED
C:\workspace\contract\build.xml:157: Following error occured while executing thi
s line
C:\workspace\contract\build-torque.xml:503: Following error occured while execut
ing this line
C:\workspace\contract\build-torque.xml:531: Exception thrown by 'properties.load
'. For more information consult the velocity log, or invoke ant with the -debug
flag.
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
tHelper.java:537)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
at org.apache.tools.ant.Main.runBuild(Main.java:632)
at org.apache.tools.ant.Main.startAnt(Main.java:183)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
Caused by: C:\workspace\contract\build-torque.xml:503: Following error occured w
hile executing this line
C:\workspace\contract\build-torque.xml:531: Exception thrown by 'proper

Re: [Torque] Using Torque again

2009-11-09 Thread Sheldon Ross
Well, I'm not sure exactly what all the properties you will need to 
define are, but try adding these to your build.properties file to start.


   useClasspath=true
   templatePath=use_classpath

Ross

Angela Day wrote:

Sheldon,
In reviewing that section of code 'torque.templatePath' is not defined.  It is 
not defined in the template from the zip file, so I am not sure what the value 
should be.  I think that is the line on which it is failing.
Would you know?
Thanks,

 
Angela Day

National Autism Association of Central Texas

http://www.naacentraltexas.org
formally FEAT Austin





____
From: Sheldon Ross 
To: Apache Torque Users List 
Sent: Mon, November 9, 2009 4:28:24 PM
Subject: Re: [Torque] Using Torque again

Ok, ant uses xml in order to define tasks. These tasks are called targets. In 
my file the target around lines 500-530 are the targets for building your OM 
objects, which I assume you're trying to do.

In those targets are references to files and properties that the target needs 
to execute.

>From my xml.

   

The "${torque.contextProperties}" file must be defined and exist (and path be 
right) for this to execute properly If it doesn't you will get errors such as you report.

Ross

Angela Day wrote:
  

No, I just replaced the build-torque.xml file with the one from torque-3.3.zip 
and just made a few little adjustments on the jar files in the classpath.  I 
updated all of my jar files to be at least as high as the dependencies list 
from the torque website.  I updated my xxx-schema.xml to point to the correct 
database_3_3.xml file.  Did I leave anything out?

Thanks,

 Angela Day
National Autism Association of Central Texas

http://www.naacentraltexas.org
formally FEAT Austin





________
From: Sheldon Ross 
To: Apache Torque Users List 
Sent: Mon, November 9, 2009 3:51:30 PM
Subject: Re: [Torque] Using Torque again

>From what I understand, in newer versions of torque you should really not be 
editing much in the build-torque.xml itself.

At the top of your file, there should be something like this.





This specifies the properties file torque will use for configuration. I'm guessing you 
either don't have these lines defined correctly, or the (in this example) 
"build.properties" file doesn't exist.


Ross

Angela Day wrote:
 


Never mind.  I realized I was missing the torque-gen-templates-3.3.jar.  But I 
am still getting the original error:

Exception thrown by 'properties.load'

I have updated all of my jar files and specified them in the build-torque.xml 
file.  I have updated my (project)-build.xml file.  I am not getting any 
complaints about any of these files.  Any Help would be appreciated.

Thanks,

 Angela Day
National Autism Association of Central Texas

http://www.naacentraltexas.org
formally FEAT Austin






From: Angela Day 
To: Apache Torque Users List 
Sent: Mon, November 9, 2009 3:18:29 PM
Subject: Re: [Torque] Using Torque again

I have been updating the build-torque.xml file and am now getting:

C:\workspace\contract\build-torque.xml:96: taskdef class 
org.apache.torque.task.TorqueDataModelTask cannot be found
I have warning decoration next to all of the taskdefs.  In what jar are these 
classes found?


Thanks,

Angela Day
National Autism Association of Central Texas

http://www.naacentraltexas.org
formally FEAT Austin






From: Sheldon Ross 
To: Apache Torque Users List 
Sent: Mon, November 9, 2009 3:00:29 PM
Subject: Re: [Torque] Using Torque again

It would appear that there are significant differences in the build.properties 
file (and/or build-torque.xml) from 1.0 to 3.3.

My suggestion is to redo your old 1.0 build.properties file and make sure it is 
of the proper form for 3.3 and use xml from 3.3

Ross

Angela Day wrote:
 
  

I am trying to upgrade from Torque 1.0 to 3.3.  I have replaced all of the jar 
files and made sure my dependencies were covered.  It is an existing 
application that
was working until I converted, so I know it is finding the project-schema.xml 
file
correctly.  This question is posted on the
internet multiple times, with no solution.  If you can help me out, I
would really appreciate it.


Thanks,
Angela


BUILD FAILED
C:\workspace\contract\build.xml:157: Following error occured while executing thi
s line
C:\workspace\contract\build-torque.xml:503: Following error occured while execut
ing this line
C:\workspace\contract\build-torque.xml:531: Exception thrown by 'properties.load
'. For more information consult the velocity log, or invoke ant with the -debug
flag.
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
tHelper.java:537)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
at org.apache.tools.ant.UnknownElement.execute(UnknownEl

Criteria needs write permissions?

2009-11-11 Thread Sheldon Ross
Ok so I was trying to make our site a little safer from sql injections, 
so I made a database connection that connects with a user that only has 
SELECT permissions. And edited Criteria like such


public Criteria()
   {
   this(DEFAULT_CAPACITY);
   this.setDbName("readonlydatabase");
   }

Now it seems to work for must things, but a couple queries fail with

throws java.lang.Exception java.lang.NullPointerException
   at org.apache.torque.util.SQLBuilder.processOrderBy(SQLBuilder.java:497)
   at 
org.apache.torque.util.SQLBuilder.buildQueryClause(SQLBuilder.java:302)

   at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:730)

This error disappears as soon as I let the criteria use a database 
connection with write privileges.
I know the user that it connects with has select privileges on every 
public table in the database.


Does criteria need update privileges to work or something?

The query the criteria constructs work fine when I connect as the 
readonly user and run it manually.


Any thoughts?

Thanks

--
Sheldon Ross



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



Re: Criteria needs write permissions?

2009-11-12 Thread Sheldon Ross
The why is a good question, the table is not found. The tables hashmap 
in the dbMap appears to be empty.
It of course is found when using the other db connection. It looks like 
I'm gonna have to dig for awhile.


Thanks.

Thomas Fischer wrote:

The null ointer exception seems to come from reading the table or column
map. Can you put a breakpoint in SQLBuilder.java:497 and see whether the
table or the column cannot be found (and why it is not found)?

Thomas

  

Ok so I was trying to make our site a little safer from sql injections,
so I made a database connection that connects with a user that only has
SELECT permissions. And edited Criteria like such

public Criteria()
{
this(DEFAULT_CAPACITY);
this.setDbName("readonlydatabase");
}

Now it seems to work for must things, but a couple queries fail with

throws java.lang.Exception java.lang.NullPointerException
at org.apache.torque.util.SQLBuilder.processOrderBy


(SQLBuilder.java:497)
  

at
org.apache.torque.util.SQLBuilder.buildQueryClause(SQLBuilder.java:302)
at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:730)

This error disappears as soon as I let the criteria use a database
connection with write privileges.
I know the user that it connects with has select privileges on every
public table in the database.

Does criteria need update privileges to work or something?

The query the criteria constructs work fine when I connect as the
readonly user and run it manually.

Any thoughts?

Thanks

--
Sheldon Ross



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





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


  


--
Sheldon Ross
Software Development
American Simmental Association
sr...@simmgene.com
(406)587-4531 ext 102 



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



Re: Criteria needs write permissions?

2009-11-12 Thread Sheldon Ross
That would probably work, but It seems a little overkill. Do you know 
where the lazy loading happens?
When I run with r/w connection, the dbmap tables hash does appear to 
load that way.

However when I run the readonly connection, it just stays empty.

Thanks

Greg Monroe wrote:

FWIW, the dbMap object get populated in a "lazy" manner by default.  However,
there is a way to force it to be fully loaded via a code call.  You 
do this by calling:


org.apache.torque.linkage.DefaultMapInit.init();

Not that this class actually exists in the generated classes and not
in the Torque package.  This is because it provided a "known" class
that "knows" (via extension) the "user settable" om package.

  

-Original Message-
From: Sheldon Ross [mailto:sr...@simmgene.com]
Sent: Thursday, November 12, 2009 3:25 PM
To: Apache Torque Users List
Subject: Re: Criteria needs write permissions?

The why is a good question, the table is not found. The tables hashmap
in the dbMap appears to be empty.
It of course is found when using the other db connection. It looks like
I'm gonna have to dig for awhile.

Thanks.

Thomas Fischer wrote:


The null ointer exception seems to come from reading the table or
  

column


map. Can you put a breakpoint in SQLBuilder.java:497 and see whether
  

the


table or the column cannot be found (and why it is not found)?

Thomas


  

Ok so I was trying to make our site a little safer from sql


injections,


so I made a database connection that connects with a user that only


has


SELECT permissions. And edited Criteria like such

public Criteria()
{
this(DEFAULT_CAPACITY);
this.setDbName("readonlydatabase");
}

Now it seems to work for must things, but a couple queries fail with

throws java.lang.Exception java.lang.NullPointerException
at org.apache.torque.util.SQLBuilder.processOrderBy



(SQLBuilder.java:497)

  

at



org.apache.torque.util.SQLBuilder.buildQueryClause(SQLBuilder.java:302)


at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:730)

This error disappears as soon as I let the criteria use a database
connection with write privileges.
I know the user that it connects with has select privileges on every
public table in the database.

Does criteria need update privileges to work or something?

The query the criteria constructs work fine when I connect as the
readonly user and run it manually.

Any thoughts?

Thanks

--
Sheldon Ross



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




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



  

--
Sheldon Ross
Software Development
American Simmental Association
sr...@simmgene.com
(406)587-4531 ext 102


-
To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@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-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@db.apache.org


  


--
Sheldon Ross
Software Development
American Simmental Association
sr...@simmgene.com
(406)587-4531 ext 102 



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



Re: Criteria needs write permissions?

2009-11-12 Thread Sheldon Ross
Ok, I think this maybe a bug. After watching the addTable method in 
DatabaseMap, It appears to add the table to the default database dbMap 
even if the criteria is querying against a different database.



Sheldon Ross wrote:
That would probably work, but It seems a little overkill. Do you know 
where the lazy loading happens?
When I run with r/w connection, the dbmap tables hash does appear to 
load that way.

However when I run the readonly connection, it just stays empty.

Thanks

Greg Monroe wrote:
FWIW, the dbMap object get populated in a "lazy" manner by default.  
However,
there is a way to force it to be fully loaded via a code call.  You 
do this by calling:


org.apache.torque.linkage.DefaultMapInit.init();

Not that this class actually exists in the generated classes and not
in the Torque package.  This is because it provided a "known" class
that "knows" (via extension) the "user settable" om package.

 

-Original Message-
From: Sheldon Ross [mailto:sr...@simmgene.com]
Sent: Thursday, November 12, 2009 3:25 PM
To: Apache Torque Users List
Subject: Re: Criteria needs write permissions?

The why is a good question, the table is not found. The tables hashmap
in the dbMap appears to be empty.
It of course is found when using the other db connection. It looks like
I'm gonna have to dig for awhile.

Thanks.

Thomas Fischer wrote:
   

The null ointer exception seems to come from reading the table or
  

column
   

map. Can you put a breakpoint in SQLBuilder.java:497 and see whether
  

the
   

table or the column cannot be found (and why it is not found)?

Thomas


 

Ok so I was trying to make our site a little safer from sql


injections,
   

so I made a database connection that connects with a user that only


has
   

SELECT permissions. And edited Criteria like such

public Criteria()
{
this(DEFAULT_CAPACITY);
this.setDbName("readonlydatabase");
}

Now it seems to work for must things, but a couple queries fail with

throws java.lang.Exception java.lang.NullPointerException
at org.apache.torque.util.SQLBuilder.processOrderBy



(SQLBuilder.java:497)

 

at



org.apache.torque.util.SQLBuilder.buildQueryClause(SQLBuilder.java:302)
   

at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:730)

This error disappears as soon as I let the criteria use a database
connection with write privileges.
I know the user that it connects with has select privileges on every
public table in the database.

Does criteria need update privileges to work or something?

The query the criteria constructs work fine when I connect as the
readonly user and run it manually.

Any thoughts?

Thanks

--
Sheldon Ross



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




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



  

--
Sheldon Ross
Software Development
American Simmental Association
sr...@simmgene.com
(406)587-4531 ext 102


-
To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@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-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@db.apache.org


  




--
Sheldon Ross
Software Development
American Simmental Association
sr...@simmgene.com
(406)587-4531 ext 102 



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



Re: Criteria needs write permissions?

2009-11-12 Thread Sheldon Ross

Ok, I apologize for the traffic.

Here goes, when you build the database objects, it hardcodes in the 
database name that exists in your schema.xml. The code is in the 
doBuild() method of the  ${Table}MapBuild.java


public void doBuild() throws TorqueException
   {
   dbMap = Torque.getDatabaseMap("defaultdb");

Therefore when you query against a different database, the table names 
never get added to the tables hash for that database.


I would consider this a bug as I don't think this would affect only me. 
Should I report it to the dev mailing list or something. Not sure of the 
etiquette there.


Anyway thanks all.

Sheldon Ross wrote:
Ok, I think this maybe a bug. After watching the addTable method in 
DatabaseMap, It appears to add the table to the default database dbMap 
even if the criteria is querying against a different database.



Sheldon Ross wrote:
That would probably work, but It seems a little overkill. Do you know 
where the lazy loading happens?
When I run with r/w connection, the dbmap tables hash does appear to 
load that way.

However when I run the readonly connection, it just stays empty.

Thanks

Greg Monroe wrote:
FWIW, the dbMap object get populated in a "lazy" manner by default.  
However,
there is a way to force it to be fully loaded via a code call.  You 
do this by calling:


org.apache.torque.linkage.DefaultMapInit.init();

Not that this class actually exists in the generated classes and not
in the Torque package.  This is because it provided a "known" class
that "knows" (via extension) the "user settable" om package.

 

-Original Message-
From: Sheldon Ross [mailto:sr...@simmgene.com]
Sent: Thursday, November 12, 2009 3:25 PM
To: Apache Torque Users List
Subject: Re: Criteria needs write permissions?

The why is a good question, the table is not found. The tables hashmap
in the dbMap appears to be empty.
It of course is found when using the other db connection. It looks 
like

I'm gonna have to dig for awhile.

Thanks.

Thomas Fischer wrote:
  

The null ointer exception seems to come from reading the table or
  

column
  

map. Can you put a breakpoint in SQLBuilder.java:497 and see whether
  

the
  

table or the column cannot be found (and why it is not found)?

Thomas




Ok so I was trying to make our site a little safer from sql


injections,
  

so I made a database connection that connects with a user that only


has
  

SELECT permissions. And edited Criteria like such

public Criteria()
{
this(DEFAULT_CAPACITY);
this.setDbName("readonlydatabase");
}

Now it seems to work for must things, but a couple queries fail with

throws java.lang.Exception java.lang.NullPointerException
at org.apache.torque.util.SQLBuilder.processOrderBy



(SQLBuilder.java:497)



at


org.apache.torque.util.SQLBuilder.buildQueryClause(SQLBuilder.java:302) 

  
at 
org.apache.torque.util.BasePeer.createQuery(BasePeer.java:730)


This error disappears as soon as I let the criteria use a database
connection with write privileges.
I know the user that it connects with has select privileges on every
public table in the database.

Does criteria need update privileges to work or something?

The query the criteria constructs work fine when I connect as the
readonly user and run it manually.

Any thoughts?

Thanks

--
Sheldon Ross



- 


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




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



  

--
Sheldon Ross
Software Development
American Simmental Association
sr...@simmgene.com
(406)587-4531 ext 102


-
To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@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-unsubscr...@db.apache.org
For additional comma

Re: Criteria needs write permissions?

2009-11-12 Thread Sheldon Ross

"So, people get confused when it seems like you can't use the DB objects
with more than one database connection.  But that's not true.  To use
more than one connection pool, you need to use the methods that take a
connection object."

In this case the query still fails even if you specify the connection.

The SqlBuilder assumes that the table name has been added to the dbMap at
the point where its crashing. But the table names only get added to the 
default dbMap.




Greg Monroe wrote:

OK, I think I understand what's going on here.  It's really a semi-bug
part but part a definitional issue.  This is because the term database 
name/dbname actually has two meaning in Torque.  

The first is the "schema database name", i.e. the name in your schema 
XML.  This is used to group all the database schema's Metadata in the
Database structure. 


The second meaning for this is the "database connection pool name".  This
is the name used in the runtime config to define the DB connection info.

Unfortunately, for historical reasons, these two names are "tied" 
together.  Mostly for convenience reasons... but there are a few cases 
in the utility classes where a subquery or something needs to be done

and the default DB name is used.

So, people get confused when it seems like you can't use the DB objects
with more than one database connection.  But that's not true.  To use
more than one connection pool, you need to use the methods that take a
connection object. 

To get an alternate connection, you define this in your runtime with 
a different name.  E.g. set up a different set of torque.dsfactory.

properties.

Then use the Torque.getConnection(String) to get a connection from this
pool. 


FWIW, I put forth a plan for Torque 4 to separate the connection pool
name from the schema name.  This would require objects and criteria
to track which pool they came from.
  

  

-Original Message-
From: Sheldon Ross [mailto:sr...@simmgene.com]
Sent: Thursday, November 12, 2009 4:28 PM
To: Apache Torque Users List
Subject: Re: Criteria needs write permissions?

Ok, I think this maybe a bug. After watching the addTable method in
DatabaseMap, It appears to add the table to the default database dbMap
even if the criteria is querying against a different database.


Sheldon Ross wrote:


That would probably work, but It seems a little overkill. Do you know
where the lazy loading happens?
When I run with r/w connection, the dbmap tables hash does appear to
load that way.
However when I run the readonly connection, it just stays empty.

Thanks

Greg Monroe wrote:
  

FWIW, the dbMap object get populated in a "lazy" manner by default.
However,
there is a way to force it to be fully loaded via a code call.  You
do this by calling:

org.apache.torque.linkage.DefaultMapInit.init();

Not that this class actually exists in the generated classes and not
in the Torque package.  This is because it provided a "known" class
that "knows" (via extension) the "user settable" om package.




-Original Message-
From: Sheldon Ross [mailto:sr...@simmgene.com]
Sent: Thursday, November 12, 2009 3:25 PM
To: Apache Torque Users List
Subject: Re: Criteria needs write permissions?

The why is a good question, the table is not found. The tables
  

hashmap


in the dbMap appears to be empty.
It of course is found when using the other db connection. It looks
  

like


I'm gonna have to dig for awhile.

Thanks.

Thomas Fischer wrote:

  

The null ointer exception seems to come from reading the table or



column

  

map. Can you put a breakpoint in SQLBuilder.java:497 and see whether



the

  

table or the column cannot be found (and why it is not found)?

Thomas





Ok so I was trying to make our site a little safer from sql

  

injections,

  

so I made a database connection that connects with a user that only

  

has

  

SELECT permissions. And edited Criteria like such

public Criteria()
{
this(DEFAULT_CAPACITY);
this.setDbName("readonlydatabase");
}

Now it seems to work for must things, but a couple queries fail
  

with


throws java.lang.Exception java.lang.NullPointerException
at org.apache.torque.util.SQLBuilder.processOrderBy


  

(SQLBuilder.java:497)




at


  

org.apache.torque.util.SQLBuilder.buildQueryClause(SQLBuilder.java:302)


at
  

org.apache.torque.util.BasePeer.createQuery(BasePeer.java:730)


This error disappears as soon as I let the criteria use a database
connection with write privileges.
I know the user that it connects with has select privileges on
  

every


public table in the database.

Does criteria nee

Re: Criteria needs write permissions?

2009-11-16 Thread Sheldon Ross
ue object can be used with two different
connections as long as no pool is involved?




From: Thomas Vandahl 
To: torque-user@db.apache.org
Sent: Fri, November 13, 2009 1:27:26 PM
Subject: Re: Criteria needs write permissions?

On 13.11.09 08:12, Thomas Fischer wrote:


I'm not sure whether this is a bug or not, I need to think about it. If
  

i


remember correctly, the database name is used for the database
  

connection


(including credentials) and the table layout. Probably there are some
  

cases


where this wants to be treated differently.
  

As I see it, the limitation is that a Torque object can only be used
with one database connection pool. This might or might not be considered
a bug, however, the given application type does not look typical to me.

Bye, Thomas.

-
To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@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-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@db.apache.org


  


--
Sheldon Ross
Software Development
American Simmental Association
sr...@simmgene.com
(406)587-4531 ext 102 



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



RE: Antwort: Get results as ints

2010-01-04 Thread Sheldon Ross
List records = BaseIdPeer.doSelectVillageRecords(criteria);
List cols = new ArrayList();
Iterator iter = records.iterator();
while(iter.hasNext()){
 cols.add(String.valueOf(iter.next().getValue(1)));
}
return cols;

That's how I do it.

Ross
}
On Mon, 2010-01-04 at 13:55 +0100, Ludwig Magnusson wrote:
> Yes there is a method like that.
> I'll use it then.
> /Ludwig
> 
> -Original Message-
> From: Thomas Fischer [mailto:fisc...@seitenbau.net] 
> Sent: den 4 januari 2010 13:47
> To: Apache Torque Users List
> Subject: Antwort: Get results as ints
> 
> > I would like to select all ids from a table (with a certain criteria). If
> I
> > use addSelectColumn on my criteria and do BasePeer.doSelect(criteria), I
> > only get the columns that I want but they are in form of record objects.
> Can
> > I get a list of ints, strings or whatever or do I need to convert the
> list
> > myself?
> 
> Currently, you need to convert the results yourself. It is not that
> problematic, see the generated peer code as an example. If I remember
> correctly, the record object contains value objects which have an asInt
> method, but the code is more reliable than my memory.
> 
> Thomas
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org
> 



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