Re: Dovecot Proxy

2020-09-02 Thread Thoralf Rickert-Wendt
I think, I've got a response on Serverfault, that helps me and I like to 
give a complete example here. I was able to proxy IMAP and Submission 
with the following settings:


dovecot.conf:

ssl_cert = password_query = SELECT NULL as password, 'y' as nopassword, 'y' as 
proxy, NULL as destuser, 'y' as proxy_nopipelining, host, 'y' as 
nodelay, 'y' as nologin, 'any-cert' a

s 'starttls' FROM proxy_domain WHERE domain = '%d';

# eof


The solution is to not use SSL but STARTTLS/TLS for all protocols.

Would it be a good idea, to write that into the documentation?

bye
Thoralf


Am 01.09.20 um 13:59 schrieb Thoralf Rickert-Wendt:


Hi Philon,

now, it's time for "Mahlzeit" ;-)

Sorry, that I read the wiki1 instead of wiki2. I thought the 1 means 
that it is server one of ... my fault. Also not reading the first line 
above the menu. My focus was really on the content. ;-)


Also my problem with the doc of Dovecot2 proxy is, that the document 
https://doc.dovecot.org/configuration_manual/authentication/proxies/ 
has less details for a domain only example. That works as in the 
Dovecot1 doc, but it isn't documented anymore. Also the location under 
"authentication" chapter in the Wiki didn't tell me, that this is the 
"new Dovecot proxy documentation". I thought, this was only related to 
authentication issues. I would recommend to either restructure the 
wiki2, that it makes it more clear to the user or make some notes on 
https://doc.dovecot.org/admin_manual/dovecot_proxy/ and link to the 
passdb setting on 
https://doc.dovecot.org/configuration_manual/forwarding_parameters/ 
and 
https://doc.dovecot.org/configuration_manual/authentication/proxies/. 
Maybe there are other documents related to Proxy too, like the SNI 
settings etc. But maybe I'm the only one on the planet, that tries to 
use that. It feels a little bit like that.


The Director would be interesting, if all the mailservers in the 
backend would know each other. But thats not the case. Mailserver A 
and Mailserver B are hosting complete different domains with a 
complete different user list and complete different user admins, etc. 
Also mailcow doesnt enabled the director. So it will not help much. 
But it could be interesting, if I have multiple proxies.


Yes, the submission service inside Dovecot is there. And I tried to 
avoid to install multiple "programs" and if there is one "program" 
that handles it all, why don't use it. And I'd like to quote the first 
line of the Dovecot proxy doc: "Dovecot supports proxying IMAP, POP3, 
Submission Server 
<https://doc.dovecot.org/admin_manual/submission_server/#submission-server>, 
LMTP Server 
<https://doc.dovecot.org/configuration_manual/protocols/lmtp_server/#lmtp-server>, 
and Pigeonhole ManageSieve Server 
<https://doc.dovecot.org/admin_manual/pigeonhole_managesieve_server/#pigeonhole-managesieve-server> 
connections to other hosts.".


Also I tried to open the Dovecot authentication mechanism for postfix 
(for submission) with



service auth {
  user = root
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}

And on Postfix part with

smtpd_sasl_auth_enabled = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

But the postfix login is always accepted (even with wrong passwords) 
and after I start to write a Mail the connection get lost after RCPT 
command. There is another problem. Before I infestigate it, I would 
try my luck with Dovecot. It is already asking the correct backend 
submission server but with SSL on a non-SSL port.


So - someone included the Submission protocol in Dovecot and someone 
wrote, that the submission could be proxied - but - its not completly 
documented or "it doesn't work" within a SSL environment. I searched 
for a simple example, where IMAP and POP3 are proxied via SSL and 
Submission too (which would mean, that Dovecot submission listens on 
465) or via STARTTLS on 587 and redirecting it also to STARTTLS/587. 
But I didn't find anything. Also the submission documentation doesnt 
help, because I cant see any line of configuration file in it.


Ok, but first - lunchtime.

bye
Thoralf

Am 01.09.20 um 09:43 schrieb Philon:

Hi Thoralf,

I’d say first of all you should read the current docs for 2.x not the archived 
stuff. —>https://wiki2.dovecot.org/  - (It’s even mentioned in bold in the 
header)

Then to front multiple backends perhaps you want to take a look at Dovecot 
Director. —>https://wiki2.dovecot.org/Director

About SMTP I’m not sure why you would want to rely on Dovecot for that. I only 
do Postfix with Dovecot as auth backend so they can share passdb access. When 
you have 465 set up it is no big deal to also enable 587 in Postfixs master.cf.

If you want to keep Dovecot for Submission you can check the latest docs for 
Dovecot submission 
service:https://doc.dovecot.org/admin_manual

Re: Dovecot Proxy

2020-09-01 Thread Thoralf Rickert-Wendt

Hi Philon,

now, it's time for "Mahlzeit" ;-)

Sorry, that I read the wiki1 instead of wiki2. I thought the 1 means 
that it is server one of ... my fault. Also not reading the first line 
above the menu. My focus was really on the content. ;-)


Also my problem with the doc of Dovecot2 proxy is, that the document 
https://doc.dovecot.org/configuration_manual/authentication/proxies/ has 
less details for a domain only example. That works as in the Dovecot1 
doc, but it isn't documented anymore. Also the location under 
"authentication" chapter in the Wiki didn't tell me, that this is the 
"new Dovecot proxy documentation". I thought, this was only related to 
authentication issues. I would recommend to either restructure the 
wiki2, that it makes it more clear to the user or make some notes on 
https://doc.dovecot.org/admin_manual/dovecot_proxy/ and link to the 
passdb setting on 
https://doc.dovecot.org/configuration_manual/forwarding_parameters/ and 
https://doc.dovecot.org/configuration_manual/authentication/proxies/. 
Maybe there are other documents related to Proxy too, like the SNI 
settings etc. But maybe I'm the only one on the planet, that tries to 
use that. It feels a little bit like that.


The Director would be interesting, if all the mailservers in the backend 
would know each other. But thats not the case. Mailserver A and 
Mailserver B are hosting complete different domains with a complete 
different user list and complete different user admins, etc. Also 
mailcow doesnt enabled the director. So it will not help much. But it 
could be interesting, if I have multiple proxies.


Yes, the submission service inside Dovecot is there. And I tried to 
avoid to install multiple "programs" and if there is one "program" that 
handles it all, why don't use it. And I'd like to quote the first line 
of the Dovecot proxy doc: "Dovecot supports proxying IMAP, POP3, 
Submission Server 
<https://doc.dovecot.org/admin_manual/submission_server/#submission-server>, 
LMTP Server 
<https://doc.dovecot.org/configuration_manual/protocols/lmtp_server/#lmtp-server>, 
and Pigeonhole ManageSieve Server 
<https://doc.dovecot.org/admin_manual/pigeonhole_managesieve_server/#pigeonhole-managesieve-server> 
connections to other hosts.".


Also I tried to open the Dovecot authentication mechanism for postfix 
(for submission) with



service auth {
  user = root
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}

And on Postfix part with

smtpd_sasl_auth_enabled = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

But the postfix login is always accepted (even with wrong passwords) and 
after I start to write a Mail the connection get lost after RCPT 
command. There is another problem. Before I infestigate it, I would try 
my luck with Dovecot. It is already asking the correct backend 
submission server but with SSL on a non-SSL port.


So - someone included the Submission protocol in Dovecot and someone 
wrote, that the submission could be proxied - but - its not completly 
documented or "it doesn't work" within a SSL environment. I searched for 
a simple example, where IMAP and POP3 are proxied via SSL and Submission 
too (which would mean, that Dovecot submission listens on 465) or via 
STARTTLS on 587 and redirecting it also to STARTTLS/587. But I didn't 
find anything. Also the submission documentation doesnt help, because I 
cant see any line of configuration file in it.


Ok, but first - lunchtime.

bye
Thoralf

Am 01.09.20 um 09:43 schrieb Philon:

Hi Thoralf,

I’d say first of all you should read the current docs for 2.x not the archived 
stuff. —> https://wiki2.dovecot.org/ - (It’s even mentioned in bold in the 
header)

Then to front multiple backends perhaps you want to take a look at Dovecot 
Director. —> https://wiki2.dovecot.org/Director

About SMTP I’m not sure why you would want to rely on Dovecot for that. I only 
do Postfix with Dovecot as auth backend so they can share passdb access. When 
you have 465 set up it is no big deal to also enable 587 in Postfixs master.cf.

If you want to keep Dovecot for Submission you can check the latest docs for 
Dovecot submission service: 
https://doc.dovecot.org/admin_manual/submission_server/. It has a relay server 
option with port. Also settings for STARTTLS etcpp can be found there.


Mahlzeit!

Philon


On 31 Aug 2020, at 11:33, Thoralf Rickert-Wendt  wrote:

Hello everyone,

it's my first post here on this mailing list and I hope, I make it right.

I posted a question on 
https://serverfault.com/questions/1031441/dovecot-as-proxy-with-submission and 
nobody was able to answer it. So I decided to push that question here (I'm 
talking about any new dovecot version and I've tested it with 2.3.4.1 
(f79e8e7e4)).

I try to run a dovecot proxy in front of a big number of mail servers (serving SM

Dovecot Proxy

2020-08-31 Thread Thoralf Rickert-Wendt

Hello everyone,

it's my first post here on this mailing list and I hope, I make it right.

I posted a question on 
https://serverfault.com/questions/1031441/dovecot-as-proxy-with-submission 
and nobody was able to answer it. So I decided to push that question 
here (I'm talking about any new dovecot version and I've tested it with 
2.3.4.1 (f79e8e7e4)).


I try to run a dovecot proxy in front of a big number of mail servers 
(serving SMTP-in, submission, IMAP, POP3, Sieve). I need that proxy, 
because I run out of IPv4 addresses. Of course I use IPv6 too, but many 
customers still have problems with there providers and they really don't 
want to share their mails on a "shared-mailserver". I planed to use 
Dovecot for IMAPS, POP3S, SMTP-submission(465) and postfix for the rest. 
If I find a solution for sieve, I would try that too, but that is very 
optional.


With the documentation https://wiki1.dovecot.org/HowTo/ImapProxy (which 
is really old and should be updated) and some other ascii docs (from an 
Apple mirror somewhere deep in the web) I was able to build a IMAP/POP3 
proxy that forwards requests from outside to a specific backend using 
SSL (993,995). That works - I think.You can find the config on the 
serverfault page.


In general - all known domains in backend are using SSL and the passdb 
forwards all requests to the backend via SSL. So - I understand:||


|password_query =
  SELECT
    NULL AS password,
    NULL AS destuser,
    host,
    'Y' AS nologin,
    'Y' AS nodelay,
    'Y' AS nopassword,
    'Y' AS proxy,
    'any-cert' AS `ssl`
  FROM
    proxy_domain
  WHERE
    domain = '%d' |

But that is only 50% of the show. The rest ist submission (and maybe 
sieve). Practically the submission implementation in dovecot works too. 
But because dovecot by default only opens port 587 (starttls), my passdb 
setting has a problem.


When I try to use that port Dovecot tries to use SSL on the backend/587 
too - but that is wrong (it should either use 465 or should try to use 
starttls).


So, I have the following options.

- find a way to configure dovecot-proxy to listen on 465 with SSL for 
submission service and hope that it uses the same port

  - but I didn't find any documentation for that and need help

- find a way to configure dovecot-proxy/passdb to return starttls=y when 
dovecot-submission is used (use a different passdb)
  - but I didn't find any documentation for that and I'm not sure, if 
this worls on service/protocol level


- find a way to configure the passdb answer based on the used 
port/protocol. But I only know the parameter %u, %d and %p.
  - so it would be nice to find a way to also select the protocol (if 
already developed)


- find a way to make a patch in dovecot (which isn't easy for me, 
because I don't really know the code)


Has somebody an idea, how I can configure the dovecot-proxy in that way.

bye
Thoralf




Strange NPEs after redeploy

2008-12-29 Thread Thoralf Rickert

Hi all,

I'm note sure, if this is a log4j issue but maybe you can give me a clue
where to look. Actually I want to update from Velocity 1.4 to 1.6. This
means I have to update some other libraries too including
commons-logging. I'm using now log4j 1.2.15 and commons-logging-1.1.1.
After resolving all other dependencies (commons-digester-1.8) I have a
problem restarting my tomcat. If I start the tomcat everything is ok.
But when I redeploy an application the underlying libaries
(commons-digester, commons-httpclient and so on) are working strange and
the servlet is marked as unavailable. I tracked it down to a
NullPointerException in org.apache.log4j.Category.isEnabledFor():749 or
Category.log() line 852.

On both places the method tries to call a method on the variable
repository. And that's what I don't understand. After reploying I got
log messages from my own code via log4j in my log file as expected. But
during this redeployment I call (just as an example) a Apache HTTP
client new GetMethod() to retrieve some informations from another
server. And that throws a NPE. For me it seems that the HTTP client or
the digester is using an uninitialized logging system - but I do log
messages to the same system all the time. Do you know any circumstance
which can explain my exceptions?

java.lang.NullPointerException
   at org.apache.log4j.Category.log(Category.java:852)
   at org.apache.commons.logging.impl.Log4JLogger.
  trace(Log4JLogger.java:152)
   at org.apache.commons.httpclient.methods.GetMethod.
  init(GetMethod.java:89)
   at com.cadooz.framework.io.HTTPClient.get(HTTPClient.java:170)


or

15:30:04.417 ERROR ache.commons.digester.Digester End event threw exception
java.lang.NullPointerException
   at org.apache.log4j.Category.isEnabledFor(Category.java:749)
   at org.apache.commons.logging.impl.Log4JLogger.
  isTraceEnabled(Log4JLogger.java:333)
   at org.apache.commons.beanutils.MethodUtils.
  getMatchingAccessibleMethod(MethodUtils.java:521)
   at org.apache.commons.beanutils.MethodUtils.
  invokeMethod(MethodUtils.java:209)
   at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:217)
   at org.apache.commons.digester.Rule.end(Rule.java:253)
   at org.apache.commons.digester.Digester.endElement(Digester.java:1222)
   at org.apache.xerces.parsers.AbstractSAXParser.endElement()
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.
  scanEndElement(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
  $FragmentContentDispatcher.dispatch()

I'm relativly sure that there is no configuration problem or dependency
problem because the tomcat is starting normal and the application is
working as expected. But after redeploying the WAR file the application
crashes. I'm not sure if this is a log4j, a commons-logging, a Tomcat, a
commons digester or whatever problem. But all this worked a couple of
hours ago before updating the libraries. I'd not find any useful
information at Google  Co.

Thanks
Thoralf

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



Re: Strange NPEs after redeploy

2008-12-29 Thread Thoralf Rickert

Hi,

yes, that works. Great - thanks!

bye
Thoralf


Ceki Gulcu schrieb:

Hello Thoralf,

The problem you are facing is probably related to the clean up code
Tomcat invokes when it redeploys web-apps. Replace commons-logging.jar
with jcl-over-slf4j.jar and your problem will go away. You need to add
slf4j-api.jar and slf4j-log4j.jar to you class path (in addition to
log4j.jar and commons-loggig.jar). See http://www.slf4j.org/ for more
details.

Please report back to confirm that the above solved the problem you
are facing.

HTH,


Thoralf Rickert wrote:

Hi all,

I'm note sure, if this is a log4j issue but maybe you can give me a clue
where to look. Actually I want to update from Velocity 1.4 to 1.6. This
means I have to update some other libraries too including
commons-logging. I'm using now log4j 1.2.15 and commons-logging-1.1.1.
After resolving all other dependencies (commons-digester-1.8) I have a
problem restarting my tomcat. If I start the tomcat everything is ok.
But when I redeploy an application the underlying libaries
(commons-digester, commons-httpclient and so on) are working strange and
the servlet is marked as unavailable. I tracked it down to a
NullPointerException in org.apache.log4j.Category.isEnabledFor():749 or
Category.log() line 852.

On both places the method tries to call a method on the variable
repository. And that's what I don't understand. After reploying I got
log messages from my own code via log4j in my log file as expected. But
during this redeployment I call (just as an example) a Apache HTTP
client new GetMethod() to retrieve some informations from another
server. And that throws a NPE. For me it seems that the HTTP client or
the digester is using an uninitialized logging system - but I do log
messages to the same system all the time. Do you know any circumstance
which can explain my exceptions?

java.lang.NullPointerException
   at org.apache.log4j.Category.log(Category.java:852)
   at org.apache.commons.logging.impl.Log4JLogger.
  trace(Log4JLogger.java:152)
   at org.apache.commons.httpclient.methods.GetMethod.
  init(GetMethod.java:89)
   at com.cadooz.framework.io.HTTPClient.get(HTTPClient.java:170)


or

15:30:04.417 ERROR ache.commons.digester.Digester End event threw 
exception

java.lang.NullPointerException
   at org.apache.log4j.Category.isEnabledFor(Category.java:749)
   at org.apache.commons.logging.impl.Log4JLogger.
  isTraceEnabled(Log4JLogger.java:333)
   at org.apache.commons.beanutils.MethodUtils.
  getMatchingAccessibleMethod(MethodUtils.java:521)
   at org.apache.commons.beanutils.MethodUtils.
  invokeMethod(MethodUtils.java:209)
   at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:217)
   at org.apache.commons.digester.Rule.end(Rule.java:253)
   at org.apache.commons.digester.Digester.endElement(Digester.java:1222)
   at org.apache.xerces.parsers.AbstractSAXParser.endElement()
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.
  scanEndElement(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
  $FragmentContentDispatcher.dispatch()

I'm relativly sure that there is no configuration problem or dependency
problem because the tomcat is starting normal and the application is
working as expected. But after redeploying the WAR file the application
crashes. I'm not sure if this is a log4j, a commons-logging, a Tomcat, a
commons digester or whatever problem. But all this worked a couple of
hours ago before updating the libraries. I'd not find any useful
information at Google  Co.

Thanks
Thoralf





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



AW: Derby autogenereted keys

2008-05-27 Thread Thoralf Rickert
Oh, I didn't checked that. I only added the idMethod attribute to database, 
because I need it in every table.


 -Ursprüngliche Nachricht-
 Von: Thomas Vandahl [mailto:[EMAIL PROTECTED]
 Gesendet: Sonntag, 25. Mai 2008 13:16
 An: Apache Torque Users List
 Betreff: Re: Derby autogenereted keys

 Thoralf Rickert wrote:
  I've defined a table:
 
  table name=report
column name=id required=true type=BIGINT primaryKey=true
  autoIncrement=true/

 Does table name=report idMethod=native change something?

 Bye, Thomas.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature


[jira] Created: (TORQUE-116) property for object state

2008-05-27 Thread Thoralf Rickert (JIRA)
property for object state
-

 Key: TORQUE-116
 URL: https://issues.apache.org/jira/browse/TORQUE-116
 Project: Torque
  Issue Type: Improvement
  Components: Generator, Runtime
 Environment: n/a
Reporter: Thoralf Rickert
Priority: Minor


Sometimes it would be very helpful to know the state of an Object. Currently we 
have the states new and modified. Additionally I think there could be at 
least one state more. During initializing of the object (populateObject) the 
Base class calls some setters in the object. It would be nice to now that this 
set-methods are called during the initializing phase of the object to change 
the behavior of the method.

The populateObject method could set an internal method isPopulating at the 
beginning of the process to true. And at the end it should set this variable to 
false. Then someone could check that variable state.

Another situation would be save in an threaded and 
not-thread-safe-environment.

This work for this is minimal. We need only a change in the templates.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Derby autogenereted keys

2008-05-24 Thread Thoralf Rickert
Hi,

yes that's it. I forgot the defaultIdMethod. That happens when I don't copy  
paste the definition from one file to another. Definitely user-fault!

Thanks
Thoralf



-Urspr?ngliche Nachricht-
Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 22. Mai 2008 20:58
An: Apache Torque Users List
Betreff: RE: Derby autogenereted keys


Just add the attribute:

defaultIdMethod=native

to the database ... tag.  This will create the SQL needed for
autoincrement fields.


To be precise, for all primary keys. The autoincrement attribute is not needed 
at all and should not be used; better use the idMethod and defaultIdMethod 
attributes.

   Thomas


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


smime.p7s
Description: S/MIME cryptographic signature


Bug#460398:

2008-04-25 Thread Thoralf Rickert
I have this bug also/too in 1.2.26-2.




smime.p7s
Description: S/MIME cryptographic signature
___
pkg-java-maintainers mailing list
pkg-java-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-java-maintainers

Bug#460398:

2008-04-25 Thread Thoralf Rickert
I have this bug also/too in 1.2.26-2.




smime.p7s
Description: S/MIME cryptographic signature


AW: RE: Column names with spaces

2008-04-15 Thread Thoralf Rickert
Hi,

I found now another workaround for me. I've changed the SQLBuilder and added 
the the method getTableName() a new parameter boolean allowSpaces. If this 
parameter is true, then the inner method removeQualifiers() doesn't check for 
spaces inside the given column name.

Additionally I added a new parameter/field to Criteria to set this value per 
Criteria. The SQLBuilder.processSelectColumns() method takes the field and 
calls the getTableName() with it. Then I create a new Criteria and set 
criteria.setAllowSpaces(true).


The only other part that I have to setup is to change the problematic constants 
in generated Base...Peer classes. For example change the String from 
tableName.column name to tableName.[column name]. I would make a new 
escape character for this in the config or XML template. Maybe it is enough 
to change the XML name for the column.

  column name=[column name] javaName=columnName type=INTEGER/

But actually I have to edit the generated classes in both methods because the 
constant names for the column names is always like the column name with a 
space. Hmm, but for this I could also make a patch to remove all 
non-Java-characters (umlauts, spaces and brackets).

If you want a patch for the first part, please let me know.

bye
Thoralf




 -Ursprüngliche Nachricht-
 Von: Greg Monroe [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 11. April 2008 15:16
 An: Apache Torque Users List
 Betreff: RE: Column names with spaces

 OK, short version:  If you can't change the existing schema,
 use a view to get valid names.

 Longer version:

 Actually, the [ syntax is not the only one that can be used
 with MS SQL. It also supports the SQL Standard defined
 delimited identifiers.  In the standard, normal identifiers
 (e.g. column/table names) have the same rules as Java/C
 variables. (with the exception that they are case insensitive...)

 If you want/need to use characters outside of this set, you
 need to use delimited identifiers.  These have the Standard
 defined syntax of My Table! (double quote's included).
 Delimited identifiers ARE case sensitive.
 So, the standards version id of a column in your table would
 be written like: Time after.time_col

 AFAIK, this syntax is pretty widely supported by the major DB players.

 As Thomas F said, getting Torque to recognize and map the
 Java names to the real names is going to be a hard thing.

 One thing that *might* work out of the box is the various ant
 tasks.  If you define your names in the XML to include the
 double quotes, the SQL generated by these should work.

 To be complete, I guess you could also try to generate the
 code with the delimited cases and then fix up the classes
 that don't compile.  You'd also have to make sure the Map
 classes used the correct strings as well.  Not very
 maintainable but...


  -Original Message-
  From: Thoralf Rickert [mailto:[EMAIL PROTECTED]
  Sent: Friday, April 11, 2008 8:39 AM
  To: 'Apache Torque Users List'
  Subject: Column names with spaces
 
  Hi,
 
  Of course the list of problems with mssql doesn't stop...
 
  I've got now a xml schema from the existing database. Some lovely
 boy
  decided years ago that it would be nice to use spaces inside the
 column
  names of the database scheme. For example: Time after.
 This is not a
  problem if you use the special syntax [Time after] in a
 select. But
 I
  don't have this kind of access with Torque (prove me wrong, if not).
 If
  I try to make a Criteria, Torque quits this selection with
 
  Malformed column name in Criteria getTableName: 'T_Stammdaten.Time
  after' is not of the form 'table.column'
 
  Okay, actually this is an error that doesn't have something
 to do with
  the real problem. Is there a way to setup a database
 specific syntax
  for column names. So in MySQL it would be ` or in MSSQL/Sybase it
  would be [ and ].
 
  Additionally - I think the torque task that generates the classes
  should escape the spaces if it uses the database column names to
  generate column constants (currently it produces
 
  public static String TIME AFTER = 
 
  Has somebody an idea, how to get around this problem?
 
 
  Bye
  Thoralf
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED

AW: MSSQL JDBC2XML Task generates no XML

2008-04-11 Thread Thoralf Rickert
Okay, that was the problem.

The schema must be dbo. My fault.

Thanks
Thoralf





 -Ursprüngliche Nachricht-
 Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
 Gesendet: Donnerstag, 10. April 2008 18:34
 An: Apache Torque Users List
 Betreff: AW: MSSQL JDBC2XML Task generates no XML

 Did you try to use the configured schema name instead of %
 ? Maybe a case sensitivity issue ?

 Sorry, just wild guesses,

 Thomas

 Thoralf Rickert [EMAIL PROTECTED] schrieb am
 10.04.2008 18:05:45:

   What Torque does is it opens a connection to the db, goes for the
   metadata of the connection and makes the call
  
tableNames = dbMeta.getTables(null, dbSchema, %, types);
  
   Maybe you can try to do this manually and play around to see what
   goes wrong ?
  
   It may also be that you have a permission problem and the
 orgasales
   user is not allowed to list all tables...
 
 
  Sorry, I forgot to tell you. I allready tried this:
 
  --
 
 Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver).
 newInstance();

  Connection connection = DriverManager.getConnection
 (jdbc:sqlserver://srv-
 
 poseidon;instanceName=orgasales;databaseName=OrgaSales;SelectM
 ethod=cursor;
  integratedSecurity=true, orgasales, password);
 
  DatabaseMetaData metadata = connection.getMetaData();
 String[] names =
  {TABLE}; ResultSet tableNames = metadata.getTables(null,
 %, %,
  names); int size = 0; while (tableNames.next()) {
System.out.println(tableNames.getString(TABLE_NAME));
size++;
  }
  System.out.println(Found +size+ tables);
  --
 
  The result has 346 tables. So the db user has access to the
 db and can
 read
  the metadata.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature


Column names with spaces

2008-04-11 Thread Thoralf Rickert
Hi,

Of course the list of problems with mssql doesn't stop...

I've got now a xml schema from the existing database. Some lovely boy decided 
years ago that it would be nice to use spaces inside the column names of the 
database scheme. For example: Time after. This is not a problem if you use 
the special syntax [Time after] in a select. But I don't have this kind of 
access with Torque (prove me wrong, if not). If I try to make a Criteria, 
Torque quits this selection with

Malformed column name in Criteria getTableName: 'T_Stammdaten.Time after' is 
not of the form 'table.column'

Okay, actually this is an error that doesn't have something to do with the real 
problem. Is there a way to setup a database specific syntax for column names. 
So in MySQL it would be ` or in MSSQL/Sybase it would be [ and ].

Additionally - I think the torque task that generates the classes should 
escape the spaces if it uses the database column names to generate column 
constants (currently it produces

public static String TIME AFTER = 

Has somebody an idea, how to get around this problem?


Bye
Thoralf


smime.p7s
Description: S/MIME cryptographic signature


AW: RE: Column names with spaces

2008-04-11 Thread Thoralf Rickert
Hi,

Thanks for the answers.

I think the View is the best solution for now.

The changes to all the Base* classes and Base*Peers is not a problem, but the 
criteria and the generated sql commands don't like the spaces if it isn't 
escaped.

bye
Thoralf

 -Ursprüngliche Nachricht-
 Von: Greg Monroe [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 11. April 2008 15:16
 An: Apache Torque Users List
 Betreff: RE: Column names with spaces

 OK, short version:  If you can't change the existing schema,
 use a view to get valid names.

 Longer version:

 Actually, the [ syntax is not the only one that can be used
 with MS SQL. It also supports the SQL Standard defined
 delimited identifiers.  In the standard, normal identifiers
 (e.g. column/table names) have the same rules as Java/C
 variables. (with the exception that they are case insensitive...)

 If you want/need to use characters outside of this set, you
 need to use delimited identifiers.  These have the Standard
 defined syntax of My Table! (double quote's included).
 Delimited identifiers ARE case sensitive.
 So, the standards version id of a column in your table would
 be written like: Time after.time_col

 AFAIK, this syntax is pretty widely supported by the major DB players.

 As Thomas F said, getting Torque to recognize and map the
 Java names to the real names is going to be a hard thing.

 One thing that *might* work out of the box is the various ant
 tasks.  If you define your names in the XML to include the
 double quotes, the SQL generated by these should work.

 To be complete, I guess you could also try to generate the
 code with the delimited cases and then fix up the classes
 that don't compile.  You'd also have to make sure the Map
 classes used the correct strings as well.  Not very
 maintainable but...


  -Original Message-
  From: Thoralf Rickert [mailto:[EMAIL PROTECTED]
  Sent: Friday, April 11, 2008 8:39 AM
  To: 'Apache Torque Users List'
  Subject: Column names with spaces
 
  Hi,
 
  Of course the list of problems with mssql doesn't stop...
 
  I've got now a xml schema from the existing database. Some lovely
 boy
  decided years ago that it would be nice to use spaces inside the
 column
  names of the database scheme. For example: Time after.
 This is not a
  problem if you use the special syntax [Time after] in a
 select. But
 I
  don't have this kind of access with Torque (prove me wrong, if not).
 If
  I try to make a Criteria, Torque quits this selection with
 
  Malformed column name in Criteria getTableName: 'T_Stammdaten.Time
  after' is not of the form 'table.column'
 
  Okay, actually this is an error that doesn't have something
 to do with
  the real problem. Is there a way to setup a database
 specific syntax
  for column names. So in MySQL it would be ` or in MSSQL/Sybase it
  would be [ and ].
 
  Additionally - I think the torque task that generates the classes
  should escape the spaces if it uses the database column names to
  generate column constants (currently it produces
 
  public static String TIME AFTER = 
 
  Has somebody an idea, how to get around this problem?
 
 
  Bye
  Thoralf
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature


MSSQL JDBC2XML Task generates no XML

2008-04-10 Thread Thoralf Rickert
Hi all,

I try to extract a database schema from a SQL Server 2005. I tried both drivers 
jTDS and the Microsoft JDBC Driver 1.2. In both versions I can access the 
database, but the resulting XML schema for Torque is empty.

When I run the JDBC task in build-torque.xml (fresh 3.3) I got this console 
response:

jdbc:
 [echo] +---+
 [echo] |   |
 [echo] | Generating XML from JDBC connection ! |
 [echo] |   |
 [echo] +---+
[torque-jdbc-transform] Torque - JDBCToXMLSchema starting
[torque-jdbc-transform] Your DB settings are:
[torque-jdbc-transform] driver : com.microsoft.sqlserver.jdbc.SQLServerDriver
[torque-jdbc-transform] URL : 
jdbc:sqlserver://srv-poseidon;instanceName=orgasales;databaseName=OrgaSales;SelectMethod=cursor;integratedSecurity=true
[torque-jdbc-transform] user : orgasales
[torque-jdbc-transform] schema : orgasales
[torque-jdbc-transform] DB driver sucessfuly instantiated
[torque-jdbc-transform] DB connection established
[torque-jdbc-transform] Getting table list...
[torque-jdbc-transform] Building column/table map...
[torque-jdbc-transform] ./resources/schema/schema.xml
[torque-jdbc-transform] Torque - JDBCToXMLSchema finished
 [echo] ...done.
BUILD SUCCESSFUL
Total time: 922 milliseconds

That looks good for me. When I use the jTDS driver only the URL is different.
But the resulting XML file looks like this:

?xml version=1.0?
!DOCTYPE database SYSTEM http://db.apache.org/torque/dtd/database_3_3.dtd;
!-- Autogenerated by JDBCToXMLSchema! --
database name=orgasales/
Hmmm, that's not good. Actually the database has more then 100 tables, the user 
'orgasales' has admin rights and I can connect to the database via the MSSQL 
console from my developer pc. The only thing that I didn't try is to call the 
program directly on the machine. But this shouldn't be a problem, because I can 
connect remotely.

The config file looks like this:

torque.database.host = srv-poseidon.cadooz-ag.intern
torque.database.type = mssql
torque.database.adaptor = mssql
torque.database.user = orgasales
torque.database.password = ...
torque.database.schema = orgasales
torque.database.driver = com.microsoft.sqlserver.jdbc.SQLServerDriver
torque.database.url = 
jdbc:sqlserver://srv-poseidon;instanceName=orgasales;databaseName=OrgaSales;SelectMethod=cursor;integratedSecurity=true
torque.database.buildUrl = ${torque.database.url}
torque.database.validationQuery = SELECT 1
torque.database.default = orgasales
torque.database.cadooz.adapter = ${torque.database.type}
torque.dsfactory.cadooz.factory = 
org.apache.torque.dsfactory.SharedPoolDataSourceFactory
torque.dsfactory.cadooz.pool.maxIdle = 8
torque.dsfactory.cadooz.pool.maxActive = 10
torque.dsfactory.cadooz.pool.maxWait = 1
torque.dsfactory.cadooz.pool.timeBetweenEvictionRunsMillis = 30
torque.dsfactory.cadooz.pool.minEvictableIdleTimeMillis = 360
torque.dsfactory.cadooz.pool.testOnBorrow = true
torque.dsfactory.cadooz.pool.validationQuery = 
${torque.database.validationQuery}
torque.dsfactory.cadooz.connection.driver = ${torque.database.driver}
torque.dsfactory.cadooz.connection.url = ${torque.database.url}
torque.dsfactory.cadooz.connection.user = ${torque.database.user}
torque.dsfactory.cadooz.connection.password = ${torque.database.password}
torque.manager.useCache = true
torque.home = .
torque.project = cadooz
torque.database = mssql
torque.targetPackage = com.cadooz.framework.orgasales
torque.subpackage.map = map
torque.subpackage.manager = manager
torque.runOnlyOnSchemaChange = false
torque.output.dir = .
torque.schema.dir = ${torque.home}/resources/schema
torque.java.dir = ${torque.home}/src
torque.sql.dir = ${torque.home}/resources/schema
torque.useManagers = false
In case of the jTDS driver the connection string looks like this:

torque.database.driver = net.sourceforge.jtds.jdbc.Driver
torque.database.url = 
jdbc:jtds:sqlserver://srv-poseidon.cadooz-ag.intern:1433/OrgaSales;instance=OrgaSales
Has someone an idea what I can do to get a XML schema from this database? I 
really don't like to edit the scheme file by hand this time ;-)

Thanks,
Thoralf


smime.p7s
Description: S/MIME cryptographic signature


AW: MSSQL JDBC2XML Task generates no XML

2008-04-10 Thread Thoralf Rickert
 What Torque does is it opens a connection to the db, goes for
 the metadata of the connection and makes the call

  tableNames = dbMeta.getTables(null, dbSchema, %, types);

 Maybe you can try to do this manually and play around to see
 what goes wrong ?

 It may also be that you have a permission problem and the
 orgasales user is not allowed to list all tables...


Sorry, I forgot to tell you. I allready tried this:

--
Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver).newInstance();
Connection connection = DriverManager.getConnection 
(jdbc:sqlserver://srv-poseidon;instanceName=orgasales;databaseName=OrgaSales;SelectMethod=cursor;integratedSecurity=true,
 orgasales, password);

DatabaseMetaData metadata = connection.getMetaData();
String[] names = {TABLE};
ResultSet tableNames = metadata.getTables(null, %, %, names);
int size = 0;
while (tableNames.next()) {
  System.out.println(tableNames.getString(TABLE_NAME));
  size++;
}
System.out.println(Found +size+ tables);
--

The result has 346 tables. So the db user has access to the db and can read the 
metadata.


smime.p7s
Description: S/MIME cryptographic signature


AW: RE: MSSQL JDBC2XML Task generates no XML

2008-04-10 Thread Thoralf Rickert
 One question, the tasks part of torque uses your build.properties info to 
 connect to
 the server.  Are you changing the values here or in the Torque.properties 
 file, which
 only effects the runtime?

Actually I changed the build-torque.xml to use a config.properties. Which 
contains everything. There is no other properties file in the project. I know, 
it's not very nice, but it's a dependency with some other parts of the 
application.

 It may be an SQL 2005 / jTDS driver issue.  Also are you using named pipes as 
 a
 connection method or TCP/IP?  That may be another source of trouble. I seem 
 to remember
 that with Named Pipes some alternate forms of authentication may be used, 
 such as
 trying the current network user info.

I'm sure it is TCP/IP. I try Thomas idea with the dbschema problem. It could be 
that this result doesn't return anything. That would explain why there is no 
data in the result set... Maybe this is really a case-sensitive problem. I 
already had a problem with the connection string. The instancename must be 
lowercase. Maybe this time the schema must be uppercase. I don't know. I'll 
check. That is interesting.

bye
Thoralf


smime.p7s
Description: S/MIME cryptographic signature


AW: [ANNOUNCE] Torque 3.3 released

2008-03-04 Thread Thoralf Rickert
Hi all,

I was a little bit quiet in the last months, but anyhow: Great work!

 
  How about for 4.0 we drop support for Java versions earlier than 5?
  Comments?
 +1 from me. Java5 was released 3 1/2 years ago, which will 
 probably be 4 1/2 years when 4.0 is out, given our release cycles.
Plus 
 there's retroweaver.

+1 from me too.

I've ask to help a little bit in 4.0 with one or two features. I wrote
the mail long ago (2006?) and I'm not sure, what it was. ;-) But
actually I would like to change  a lot in the templates for Java5
compatible code - changing iteration to foreach; find out, if we can
use enums; using Object... params, annotations and so on

bye
Thoralf


smime.p7s
Description: S/MIME cryptographic signature


AW: foreign-key generation maps NumberKey to int, and code fails to compile

2007-08-14 Thread Thoralf Rickert
Hi!

I'm not sure if I understand you problem. But does it make sense to declare a 
foreign key for primary key in the same table? Normally you declare the foreign 
key in COUPON and make a reference to MEMBER. Maybe Torque doesn't like this 
double key-definition in MEMBER. But I'm not sure

bye
Thoralf


 -Ursprüngliche Nachricht-
 Von: brycenesbitt [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 14. August 2007 08:59
 An: torque-user@db.apache.org
 Betreff: foreign-key generation maps NumberKey to int, and 
 code fails to compile
 
 
 
 I'm adding a table to an older Torque based application:
 
 table name=CCS_MEMBER
 column default=0 name=MEMBER_ID primaryKey=true
 required=true type=INTEGER/
 column default=  name=FIRST_NAME size=127 
 type=VARCHAR/
 column default=  name=LAST_NAME size=127 
 type=VARCHAR/
 foreign-key foreignTable=CCS_COUPON
 reference local=MEMBER_ID foreign=MEMBER_ID/
 /foreign-key
 /table
 
table name=CCS_COUPON
 column name=COUPON_ID type=INTEGER 
 primaryKey=true required=true autoIncrement=true /
 column name=MEMBER_ID   type=INTEGER 
 required=true /
 column name=EXPIRES type=DATE/
 /table
 
 But when Torque generates the classes there is a type 
 mismatch.  The coupon gets an integer for MEMBER_ID, but the 
 member generates a NumberKey.  Is there a way to resolve 
 this?  It seems OK if the primary key maps to another primary 
 key (both are NumberKeys).
 
 Is there a way to force Torque to use a NumberKey for a 
 non-primary key? Or to force Torque to use an integer for a 
 primary key (more risky, since that's a change to existing code)?
 
 If it matters, this is Torque 3.0-b4 (yes, beta 4).
 
 -- 
 View this message in context: 
 http://www.nabble.com/foreign-key-generation-maps-NumberKey-to
-int%2C-and-code-fails-to-compile-tf4265600.html#a12139688
Sent from the Apache DB - Torque Users mailing list archive at Nabble.com.


-
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]



AW: AW: foreign-key generation maps NumberKey to int, and code fails to compile

2007-08-14 Thread Thoralf Rickert
Ah, okay, a coupon has only one member. Is it possible to have a member that 
has multiple coupons? Or is it a 1:1 relation? If so, you could make a circle 
reference from member to coupon. If it is 1:n relation (I think so), then you 
should add a third table COUPON_MEMBER_RELATION with member_id,coupon_id as 
foreign keys and unique(member_id,coupon_id) and maybe unique(coupon_id).

bye
Thoralf


 -Ursprüngliche Nachricht-
 Von: brycenesbitt [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 14. August 2007 09:39
 An: torque-user@db.apache.org
 Betreff: Re: AW: foreign-key generation maps NumberKey to 
 int, and code fails to compile
 
 
 
 Hmm, ok.  But if I flip it around like that, I don't get a 
 BaseCcsMemberPeer.doSelectJoinCcsCoupon().
 
table name=CCS_MEMBER
 column default=0 name=MEMBER_ID primaryKey=true
 required=true type=INTEGER/
 column default=  name=FIRST_NAME size=127 
 type=VARCHAR/
 column default=  name=LAST_NAME size=127 
 type=VARCHAR/
 /table
 table name=CCS_COUPON
 column name=COUPON_ID   type=INTEGER 
 primaryKey=true
 required=true autoIncrement=true /
 column name=MEMBER_ID   type=INTEGER 
 required=true /
 column name=EXPIRES type=DATE/
 foreign-key foreignTable=CCS_MEMBER 
 onUpdate=none onDelete=none name=FK_COUPON
 reference local=MEMBER_ID foreign=MEMBER_ID/
 /foreign-key
 /table
 
 How can I get a BaseCcsMemberPeer.doSelectJoinCcsCoupon(), 
 which will do
 essentially:
SELECT * from CCS_MEMBER JOIN CCS_COUPON USING (MEMBER_ID);
 
 All I get is BaseCcsCouponPeer.doSelectJoinCcsMember() 
 method, which selects a collection of CcsCoupon objects 
 pre-filled with their CcsMember objects.  But this is 
 useless, since there can be only one member per coupon!  I 
 want a member object, with a list of (zero or more) coupons.
 
 
 
 Thoralf Rickert wrote:
  
  I'm not sure if I understand you problem. But does it make sense to 
  declare a foreign key for primary key in the same table? 
 Normally you 
  declare the foreign key in COUPON and make a reference to MEMBER. 
  Maybe Torque doesn't like this double key-definition in MEMBER. 
  But I'm not sure
  
  bye
  Thoralf
  
 
 -- 
 View this message in context: 
 http://www.nabble.com/foreign-key-generation-maps-NumberKey-to
-int%2C-and-code-fails-to-compile-tf4265600.html#a12140061
Sent from the Apache DB - Torque Users mailing list archive at Nabble.com.


-
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]



AW: AW: AW: foreign-key generation maps NumberKey to int, and code fails to compile

2007-08-14 Thread Thoralf Rickert
In BaseCcsCouponPeer should be a doSelectJoinCcsMember() method. The other way 
around is not implemented. So you need to program it yourself, I think. The 
member doesn't know about the coupons, so it isn't possible to build 
automatically a doSelectJoinCcsCoupons. Additionally in MemberPeer you try to 
SELECT a member and add multiple coupons to it. This isn't easy with a single 
SELECT. (because the member has multiple coupons and you'll get multiple rows 
for one member).

You could make two selects. First get the CcsMember and then call 
CcsMember.getCoupons(). This method is implemented in BaseCcsMember.


 -Ursprüngliche Nachricht-
 Von: brycenesbitt [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 14. August 2007 10:14
 An: torque-user@db.apache.org
 Betreff: Re: AW: AW: foreign-key generation maps NumberKey to 
 int, and code fails to compile
 
 
 
 Each coupon is owned by one member.
 A member may have any number of coupons.
 SQL has no trouble setting up such a relationship without a 
 third table.  Do I need the third table to satisfy Torque?
 
 
 Thoralf Rickert wrote:
  
  Ah, okay, a coupon has only one member. Is it possible to have a 
  member that has multiple coupons? Or is it a 1:1 relation? 
 If so, you 
  could make a circle reference from member to coupon. If it is 1:n 
  relation (I think so), then you should add a third table 
  COUPON_MEMBER_RELATION with member_id,coupon_id as foreign keys and 
  unique(member_id,coupon_id) and maybe unique(coupon_id).
  
  bye
  Thoralf
  
 
 -- 
 View this message in context: 
 http://www.nabble.com/foreign-key-generation-maps-NumberKey-to
-int%2C-and-code-fails-to-compile-tf4265600.html#a12140496
Sent from the Apache DB - Torque Users mailing list archive at Nabble.com.


-
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]



AW: Could not retrieve connection info from pool

2007-05-02 Thread Thoralf Rickert
Hi!

Is it possible, that your application uses many transactions? If you forget to 
close this connections - the pool is running out of connections from time to 
time. Maybe there is just one unclosed transaction somewhere in your 
application. If you have a lot of traffic on your site you can increase the 
number of max connections...but I'm sure there is missing commit() or 
safeRollback().

bye
Thoralf

 -Ursprüngliche Nachricht-
 Von: Eduardo Kinto [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 2. Mai 2007 13:09
 An: torque-user@db.apache.org
 Betreff: Could not retrieve connection info from pool
 
 
 Hello,
 
 I'm using Torque to connect to my MSSql and MySQL Server database.
 
 Everything is working fine, just one problem, some times 
 Database connection fail and don't come back (both, mysql and 
 mssql) by it self and I have to restart my webserver (where 
 it is running my application).
 
 Running the command netstat, I can't see any connnection to 
 database server.
 
 I'm using:
 - torque-3.2.jar
 - apache tomcat 5.5.12
 - java jdk 1.5.0_06
 - RedHat Linux Enterprise 4
 
 And the folowing torque setup for mysql:
 
 torque.dsfactory.APP.factory = 
 org.apache.torque.dsfactory.SharedPoolDataSourceFactory
 torque.dsfactory.APP.connection.driver = 
 com.mysql.jdbc.Driver torque.dsfactory.APP.connection.url = 
 jdbc:mysql://IP:PORT/APP?autoReconnect=true
 torque.dsfactory.APP.connection.user = yyy 
 torque.dsfactory.APP.connection.password = xxx 
 torque.dsfactory.APP.pool.defaultTransactionIsolation=1
 torque.dsfactory.APP.pool.maxWait=60
 torque.dsfactory.APP.pool.maxActive=32
 torque.dsfactory.APP.pool.maxIdle=32
 torque.dsfactory.APP.pool.testOnBorrow=true
 torque.dsfactory.APP.pool.validationQuery=SELECT 1
 
 And for MSSqlServer:
 torque.dsfactory.APP2.factory = 
 org.apache.torque.dsfactory.SharedPoolDataSourceFactory
 torque.dsfactory.APP2.connection.driver = 
 net.sourceforge.jtds.jdbc.Driver 
 torque.dsfactory.APP2.connection.url = 
 jdbc:jtds:sqlserver://IP:1433/DATABASE
 .. similary to mysql ...
 
 The ERROR message:
 org.apache.torque.TorqueException: 
 org.apache.commons.dbcp.SQLNestedException: Could not 
 retrieve connection info from pool
 at 
 org.apache.torque.TorqueInstance.getConnection(TorqueInstance.
 java:825)
 at org.apache.torque.Torque.getConnection(Torque.java:272)
 at 
 org.apache.torque.util.BasePeer.doPSSelect(BasePeer.java:1478)
 ... 
 Caused by: org.apache.commons.dbcp.SQLNestedException: Could 
 not retrieve connection info from pool
 at 
 org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPo
 oledConnectionAndInfo(SharedPoolDataSource.java:169)
 at 
 org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getC
 onnection(InstanceKeyDataSource.java:631)
 at 
 org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getC
 onnection(InstanceKeyDataSource.java:615)
 at 
 org.apache.torque.TorqueInstance.getConnection(TorqueInstance.
 java:821)
 ... 11 more
 Caused by: java.lang.NullPointerException
 at 
 org.apache.commons.collections.SequencedHashMap.removeEntry(Se
 quencedHashMap.java:215)
 at 
 org.apache.commons.collections.SequencedHashMap.removeImpl(Seq
 uencedHashMap.java:473)
 at 
 org.apache.commons.collections.SequencedHashMap.remove(Sequenc
 edHashMap.java:460)
 at org.apache.commons.collections.LRUMap.get(LRUMap.java:93)
 at 
 org.apache.commons.dbcp.datasources.SharedPoolDataSource.getUs
 erPassKey(SharedPoolDataSource.java:176)
 at 
 org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPo
 oledConnectionAndInfo(SharedPoolDataSource.java:165)
 ... 14 more
 
 
 
 Restarting my webserver everything is working fine again. 
 Can't torque re-establish a valid connection to the database 
 by it self ?
 
 I have an heavy activity on my MSSql database, sometime I get 
 the following error message: Caused by: 
 java.sql.SQLException: I/O Error: Connection reset
 at 
 net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:797)
 at 
 net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStateme
 nt.java:332)
 at 
 net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStat
 ement.java:723)
 at 
 net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStat
 ement.java:652)
 at 
 org.apache.torque.util.BasePeer.executeStatement(BasePeer.java:1294)
 ... 6 more
 
 Does the error Connection reset is telling me I'm losting 
 one connection from the pool and after losing all connection 
 I get Could not retrieve connection info from pool ? If so, 
 do I have to create a new connection and set it on the pool ?
 
 
 Thank you,
 
 Eduardo.
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Could not retrieve connection info from pool

2007-05-02 Thread Thoralf Rickert
 But if so, shoudn't I see openned connection (socket) to the 
 database server 
 ?

Hmm, I'm not sure how the commons-pool is using the connection. In my opinion: 
yes there should be a lot of open connections. But I'm not sure about this. You 
can test this by increasing the number of max allowed connections and verify if 
they are all used frequently (I know that you can get some statistics 
informations in MySQL with SHOW xyz...).


 I do have many transactions. It is an heavy application. 
 Sometimes work 
 fine for
 one or two days and then crash (stop working), both Mysql 
 and MSSQL, 
 almost
 simultaneously.
 
 The Mysql server has much less connection (transaction) than 
 MSSql, but when 
 I got the
 Could not retrieve connection info from pool both of them 
 stop working.

That's strange. I thought that the pools are independent. But your explanation 
says my that they aren't. Maybe you're right and there are some network 
problems too.


 Not all Could not retrieve connection info from pool stops 
 my application, 
 sometimes
 it continue to run just after a get that message.
 
 My guess it some network problem occurred and the container 
 could not handle re-open of the connections. Even though 
 I've set the validationQuery.
 
 Thank you.
 
 Eduardo.
 
 - Original Message - 
 From: Thoralf Rickert [EMAIL PROTECTED]
 To: Apache Torque Users List torque-user@db.apache.org
 Sent: Wednesday, May 02, 2007 8:22 AM
 Subject: AW: Could not retrieve connection info from pool
 
 
 Hi!
 
 Is it possible, that your application uses many transactions? 
 If you forget 
 to close this connections - the pool is running out of 
 connections from time 
 to time. Maybe there is just one unclosed transaction 
 somewhere in your 
 application. If you have a lot of traffic on your site you 
 can increase the 
 number of max connections...but I'm sure there is missing commit() or 
 safeRollback().
 
 bye
 Thoralf
 
  -Ursprüngliche Nachricht-
  Von: Eduardo Kinto [mailto:[EMAIL PROTECTED]
  Gesendet: Mittwoch, 2. Mai 2007 13:09
  An: torque-user@db.apache.org
  Betreff: Could not retrieve connection info from pool
 
 
  Hello,
 
  I'm using Torque to connect to my MSSql and MySQL Server database.
 
  Everything is working fine, just one problem, some times Database 
  connection fail and don't come back (both, mysql and
  mssql) by it self and I have to restart my webserver (where it is 
  running my application).
 
  Running the command netstat, I can't see any connnection to 
 database 
  server.
 
  I'm using:
  - torque-3.2.jar
  - apache tomcat 5.5.12
  - java jdk 1.5.0_06
  - RedHat Linux Enterprise 4
 
  And the folowing torque setup for mysql:
 
  torque.dsfactory.APP.factory = 
  org.apache.torque.dsfactory.SharedPoolDataSourceFactory
  torque.dsfactory.APP.connection.driver = com.mysql.jdbc.Driver 
  torque.dsfactory.APP.connection.url = 
  jdbc:mysql://IP:PORT/APP?autoReconnect=true
  torque.dsfactory.APP.connection.user = yyy 
  torque.dsfactory.APP.connection.password = xxx 
  torque.dsfactory.APP.pool.defaultTransactionIsolation=1
  torque.dsfactory.APP.pool.maxWait=60
  torque.dsfactory.APP.pool.maxActive=32
  torque.dsfactory.APP.pool.maxIdle=32
  torque.dsfactory.APP.pool.testOnBorrow=true
  torque.dsfactory.APP.pool.validationQuery=SELECT 1
 
  And for MSSqlServer:
  torque.dsfactory.APP2.factory = 
  org.apache.torque.dsfactory.SharedPoolDataSourceFactory
  torque.dsfactory.APP2.connection.driver = 
  net.sourceforge.jtds.jdbc.Driver 
 torque.dsfactory.APP2.connection.url 
  = jdbc:jtds:sqlserver://IP:1433/DATABASE
  .. similary to mysql ...
 
  The ERROR message:
  org.apache.torque.TorqueException:
  org.apache.commons.dbcp.SQLNestedException: Could not retrieve 
  connection info from pool
  at 
  org.apache.torque.TorqueInstance.getConnection(TorqueInstance.
  java:825)
  at org.apache.torque.Torque.getConnection(Torque.java:272)
  at
  org.apache.torque.util.BasePeer.doPSSelect(BasePeer.java:1478)
  ...
  Caused by: org.apache.commons.dbcp.SQLNestedException: Could not 
  retrieve connection info from pool
  at 
  org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPo
  oledConnectionAndInfo(SharedPoolDataSource.java:169)
  at 
  org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getC
  onnection(InstanceKeyDataSource.java:631)
  at 
  org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getC
  onnection(InstanceKeyDataSource.java:615)
  at 
  org.apache.torque.TorqueInstance.getConnection(TorqueInstance.
  java:821)
  ... 11 more
  Caused by: java.lang.NullPointerException
  at 
  org.apache.commons.collections.SequencedHashMap.removeEntry(Se
  quencedHashMap.java:215)
  at 
  org.apache.commons.collections.SequencedHashMap.removeImpl(Seq
  uencedHashMap.java:473)
  at 
  org.apache.commons.collections.SequencedHashMap.remove(Sequenc
  edHashMap.java:460

AW: Torque is very slow to do a .copy of an object :( Why?

2007-04-13 Thread Thoralf Rickert
Hi!

Could you try a myObject1.copy(false) to avoid making a deepcopy.

bye
Thoralf

 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.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: CriteriaEnumeration

2007-03-12 Thread Thoralf Rickert
Hi Thomas,

Yes, you're right. It's similar to LargeSelect. But I think, it has two
advantages. With the correct combination of Criteria and
CriteriaPopulator I'm able to use doSelectJoinXXX and construct multiple
Torque objects at the same time (in my example this could be a store and
the corresponding address). The second advantage is, that it implements
the Enumeration interface and my opinion is, that this is more
comprehensible.

On the other side, the read-ahead-cache seems to be very useful and
could speed up some operations. It's more aware of DB specific problems
with databases that doesn't understand the offset/limit feature.

 This is more or less what LargeSelect does. I used to use it 
 for such things - reading data one page at a time. It 
 provides the additional advantage of a read-ahead-cache, 
 means it continues reading your data in the background while 
 you can process the first page of records.


 If you are interested, I created a small LargeSelectHelper 
 class which allows you to continuously read one page at a 
 time and let LargeSelect do the chunking.


Sorry, I'm not sure, what you mean?  Do you think, it would be better
for the CriteriaEnumeration to work with the LargeSelect?

bye
Thoralf


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



CriteriaEnumeration

2007-03-09 Thread Thoralf Rickert
Hi!

I'm not sure, if this was discussed before, but I want to send you this
extension. 

Currently I'm working on somekind of backup-procedure that reads some
data from a database and creates a complex XML file (for example: stores
with addresses and products). To do this, I have to get all stores
from the database. If there are a lot of stores and I make just a
doSelect(new Criteria()) I have (of course) trouble with the memory
(number of stores  10).

I could implement a special algorithm, but I decided to implement a
mechanism that takes a Criteria and set offset/limit internally in a
loop. In this way I can get 100 stores with one SELECT and do my work.
If the pool is empty, I can read the next 100 stores.

I've enclosed this generic algorithm in a class called
CriteriaEnumeration:

---
public class CriteriaEnumerationE implements java.util.Enumeration {
  private static final Log log =
MyLog.getLogger(CriteriaEnumeration.class);
  private final java.util.VectorE fifo = new java.util.VectorE();
  
  private Criteria criteria = null;
  private CriteriaPopulatorE populator = null;
  private Connection connection = null;
  
  private int offset = 0;
  private int limit = 100;
  private boolean eot = false;
  private boolean useTransaction = false;

  /**
   * Sets the criteria for the Enumeration
   */
  public void setCriteria(Criteria criteria) {
this.criteria = criteria;
  }
  
  /**
   * Sets the populator that calls the database and creates the
   * Torque BaseObject
   */
  public void setPopulator(CriteriaPopulatorE populator) {
this.populator = populator;
  }
  
  /**
   * If true, the Enumeration uses a Transaction Connection
   * internally.
   */
  public void setTransaction(boolean useTransaction) {
this.useTransaction = useTransaction;
  }
  
  /**
   * Sets the size of the Buffer.
   */
  public void setLimit(int limit) {
this.limit = limit;
  }
  
  /**
   * @see java.util.Enumeration#hasMoreElements()
   */
  public boolean hasMoreElements() {
if (!fifo.isEmpty()) return true;
if (eot) return false;

criteria.setLimit(limit);
criteria.setOffset(offset);
offset+=limit;

if (useTransaction  connection == null) {
  try {
connection = Transaction.begin();
  } catch (Exception exception) {
log.error(Cannot use transactions.,exception);
connection = null;
  }
}

ListE elements = populator.getRows(connection,criteria);
if (Utilities.isEmpty(elements)) {
  eot = true;
  if (connection != null) {
try {
  Transaction.commit(connection);
} catch (Exception exception) {
  log.error(exception);
}
  }
}
if (eot) return false;

fifo.addAll(elements);

return true;
  }
  
  /**
   * @see java.util.Enumeration#nextElement()
   */
  public E nextElement() {
if (!hasMoreElements()) return null;
return fifo.remove(0);
  }
}
---

Note: This implementation uses a Transaction class that wraps the Torque
Transaction class

Also you need to implement a class that implements the interface
CriteriaPopulatorE

--
public interface CriteriaPopulatorE {
  public ListE getRows(Connection connection, Criteria criteria);
}
-

With this code you can iterate through the result without reading
everything at once. There are of course some problems. First the
database should accept offset and limit settings of the Criteria (like
MySQL). And second the data that you read should not change during the
enumeration. Of course there is a transaction-safe implementation, but
I'm not sure if it works in every environment. And of course this is
nothing for performance-junkies. ;-)


Here is an example with Stores

public class StorePeer extends BaseStorePeer {
  public static EnumerationStore getStores() {
Criteria criteria = new Criteria();
criteria.addAscendingOrderByColumn(ID);

CriteriaEnumerationStore enumeration = new
CriteriaEnumerationStore();
enumeration.setCriteria(criteria);
enumeration.setPopulator(new StorePopulator());
return enumeration;
  }

  static class StorePopulator implements CriteriaPopulatorStore {
public ListStore getRows(Connection connection, Criteria criteria)
{
  try {
log.debug(createQueryString(criteria));
return doSelectJoinAllExceptLogin(criteria,connection);
  } catch (Exception exception) {
log.error(exception);
return null;
  }
}
  }
}


bye
Thoralf


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (TORQUE-85) setOffset(int) in Criteria should be setOffset(long)

2007-03-09 Thread Thoralf Rickert (JIRA)
setOffset(int) in Criteria should be setOffset(long)


 Key: TORQUE-85
 URL: https://issues.apache.org/jira/browse/TORQUE-85
 Project: Torque
  Issue Type: Improvement
  Components: Runtime
Reporter: Thoralf Rickert
Priority: Minor


The Criteria.setOffset() method should accept long instead of int as the 
parameter value to allow an offset above 2 billion. Of course it's not 
recommended to have such Criteria's but it should be possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Best practice for entity update.

2007-02-09 Thread Thoralf Rickert
Hi!

If it isn't possible to use a transaction connection you can use a timestamp 
column to verify if the row is changed in the database. Before saving the 
instance you can read the timestamp column from the DB and compare it with the 
timestamp that is set in your instance (this should be done in a short 
transaction during save()).

bye
Thoralf

 -Ursprüngliche Nachricht-
 Von: Christopher Thill [mailto:[EMAIL PROTECTED] 
 Gesendet: Freitag, 9. Februar 2007 12:46
 An: Apache Torque Users List
 Betreff: Best practice for entity update.
 
 
 I wanted to ask a question about the best way to
 prevent users overwriting each others changes when
 updating the database.
 
 If you use the simplest way
   IntakeTool intake = (IntakeTool)
 context.get(ConstSpr.INTAKE_STRING);
   Group group =
 intake.get(ConstSpr.INTAKE_SPRSA_CONTRACT,IntakeTool.DEFAULT_KEY);
   SprsaRsaContract sprsa = new SprsaRsaContract();
 
   group.setProperties( sprsa );
   sprsa.save();
 
 You can over right another users changes to the
 database.
 
 I have decided to stuff the torque object used to
 build the form into the users temporary storage and
 then when the user submits the form I retreive it and
 do something like :
 
Criteria whereCriteria =
 SpscmSalesCompanyPeer.buildCriteria(this);
Criteria updateCriteria =
 SpscmSalesCompanyPeer.buildCriteria(newValues);
 
SpscmSalesCompanyPeer.doUpdate(whereCriteria,
 updateCriteria);
 
 Then check to see how many rows were updated.
 
 Any suggestions for this would be appreciated.
 
 Thanks,
 Chris
 
 -
 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]



AW: Setting foreign key column as null

2007-01-09 Thread Thoralf Rickert
Hi!

Did you try database defaultJavaType=object. Then every primitive 
(long,int,boolean,...) is an object (Long, Integer, Boolean, ...). I think, you 
cannot set this for a single table. Just for all. 

bye
Thoralf


 -Ursprüngliche Nachricht-
 Von: Shilpa Kulkarni [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 9. Januar 2007 01:21
 An: Apache Torque Users List
 Betreff: Setting foreign key column as null
 
 
 I am having trouble setting a foreign key value to null. 
 Parts of my torque schema file are below. 
 table_2.parent_asset_id has a foreign key constraint defined 
 on it  it must be either null or one of the table_1.asset_id 
 column values.
 
   table name=table_1
  idMethod=native
 column
   name=asset_id
   required=true
   primaryKey=true
   type=BIGINT
   description=ASSET ID/
   /table
 
 
   table name=table_2
  idMethod=none
 column
   name=parent_asset_id
   required=false
   primaryKey=false
   type=BIGINT /
 
 !-- Some other columns defined here. --
 
 foreign-key foreignTable=table_1
   reference
 local=parent_asset_id
 foreign=asset_id/
 /foreign-key
   /table
 
 I want to be able to write code as follows:
 
 Table2Bean table2Bean = new Table2Bean();
 table2Bean.setParentAssetId(null);
 
 However the setParentAssetId method in generated bean class 
 takes has input parameter of type 'long'. So passing null 
 does not work. 
 
 The generated method in Table2Bean class looks like this:  
 public void setParentAssetId(long v)
 {
   
 this.parentAssetId = v;
 setModified(true);
 
 }
 
 
 If the generated method was taking an object paramter (Long 
 instead of long), it would work. 
 
 Any idea how to make it work? Any help is appreciated.
 
 Shilpa
 
 
 
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com
 
 -
 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]



[jira] Created: (TORQUE-75) Map XML column informations to the generated Objects

2006-12-15 Thread Thoralf Rickert (JIRA)
Map XML column informations to the generated Objects


 Key: TORQUE-75
 URL: http://issues.apache.org/jira/browse/TORQUE-75
 Project: Torque
  Issue Type: Improvement
  Components: Generator
Reporter: Thoralf Rickert


There is a small leakage of informations between XML definition and the 
generated Object. 

For example if you define a column as required=true it would be good to get 
this information in the object. So there could be a method like 
isMandatory(COLUMNNAME). One application for this could be generic analyzing of 
objects before saving to avoid SQL exceptions.

Other informations would be size, scale and description for example.

Of course we could retrieve this informations from the database but this means 
that we have to communicate with the database and there could be database 
specific inconsistency.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Commented: (TORQUE-75) Map XML column informations to the generated Objects

2006-12-15 Thread Thoralf Rickert (JIRA)
[ 
http://issues.apache.org/jira/browse/TORQUE-75?page=comments#action_12458959 ] 

Thoralf Rickert commented on TORQUE-75:
---

Okay, then is this improvement request obsolet. Sorry.

 Map XML column informations to the generated Objects
 

 Key: TORQUE-75
 URL: http://issues.apache.org/jira/browse/TORQUE-75
 Project: Torque
  Issue Type: Improvement
  Components: Generator
Reporter: Thoralf Rickert

 There is a small leakage of informations between XML definition and the 
 generated Object. 
 For example if you define a column as required=true it would be good to get 
 this information in the object. So there could be a method like 
 isMandatory(COLUMNNAME). One application for this could be generic analyzing 
 of objects before saving to avoid SQL exceptions.
 Other informations would be size, scale and description for example.
 Of course we could retrieve this informations from the database but this 
 means that we have to communicate with the database and there could be 
 database specific inconsistency.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: BigDecimal and MySQL decimal

2006-12-14 Thread Thoralf Rickert
Try size=7,2 instead of size=.. scale=..



 -Ursprüngliche Nachricht-
 Von: Jon August [mailto:[EMAIL PROTECTED] 
 Gesendet: Donnerstag, 14. Dezember 2006 13:52
 An: Apache Torque Users List
 Betreff: Re: BigDecimal and MySQL decimal
 
 
 Hey Alvaro,
 
 Thanks for the suggestion.  I tried this:
 
  column name=pricescale=2 size=7  
 type=DECIMAL /
 
 but I get this error when I run maven torque:
 
 org.apache.torque.engine.EngineException: org.xml.sax.SAXException:  
 Error while parsing wp-schema.xml at line 13 column 77 : Attribute  
 scale must be declared for element type column.
 
 
 Is my syntax incorrect?
 
 -Jon
 
 
 
 
 
 On Dec 14, 2006, at 7:24 AM, Alvaro Coronel wrote:
 
  I have had no trouble using it just as you do. Maybe you haven't
  set the scale yet.
 
  This is an excerpt of my schema.xml file:
 
  column name=moncotiza
   required=true
   scale=2
   size=7
   type=DECIMAL /
 
  What I usually do is to define the schema.xml file and from it
  obtain the .sql file via ant to create the database.
 
  Good luck,
  Álvaro.
 
  Jon August [EMAIL PROTECTED] wrote: Hey,
 
  I'm using decimal (in the schema) to store a dollar amount 
 in my MySQL 
  database.  I get the value from a web page and convert it to a 
  BigDecimal before storing it.  For some reason, the decimal portion 
  gets truncated and $10.32 gets stored as 10.  Should I be using 
  something other than BigDecimal or is there something else wrong?
 
  Sorry if this is not a torque question.
 
  -Jon
 
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  -
  Want to start your own business? Learn how on Yahoo! Small Business.
 
 
 -
 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]



AW: duplicate ID exception in cluster

2006-12-06 Thread Thoralf Rickert
It's a little bit off-topic but have a look at How to set up a load-balanced 
MySQL cluster (http://www.howtoforge.com/loadbalanced_mysql_cluster_debian). 
If you use a load-balancing server in front of the mysql cluster you don't have 
to change your application. The HowTo uses UltraMonkey to wrap the cluster 
behind a virtual IP that you have to use in your application. It works fine.

 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Im Auftrag von Will Glass-Husain
 Gesendet: Dienstag, 5. Dezember 2006 23:43
 An: Apache Torque Users List; [EMAIL PROTECTED]
 Betreff: Re: duplicate ID exception in cluster
 
 
 Hi Henning!
 
 It's a real (Tomcat) cluster.  Two instances of Tomcat 
 talking to a single database.  (no database replication).  I 
 use Apache/mod_jk to split requests (based on session) 
 between the two Tomcats.  Allows me to run high number of 
 users with a memory-heavy application.
 
 Thought briefly about database replication but since this is 
 write-heavy application it didn't seem to make sense.
 
 thanks,
 WILL
 
 On 12/5/06, Henning P. Schmiedehausen [EMAIL PROTECTED] wrote:
  Will Glass-Husain [EMAIL PROTECTED] writes:
 
  Hi,
 
  I just set up a new 2 server cluster with two instances of Tomcat 
  both reading/writing from a single database.  I'm using 
 Torque 3.0, 
  the default ID Broker and MySQL 5. (InnoDB)
 
  Real cluster or just master/slave (or master/master with only one 
  master active at a time)? The latter is just replication, 
 not a real 
  cluster.
 
  My problem... Under heavy load, I notice that most write 
 requests on 
  one of the servers fails with a duplicate ID error.  
 Typically, each 
  page request that fails does 10-20 insert statements.
 
  Any tips as to how I might make this cluster work with 
 simultaneous 
  writes?
 
  a) in a master/master config, you can not write to both 
 masters at the
 same time. End of story. I had a summer project where we tested
 exactly that *very* extensively. It does not work. No 
 matter what you
 google on the internet or what mysql.com wants to tell 
 you. You will
 get the described error sooner or later. If you want to have
 master/master with failover, that is fine. Two active 
 masters not.
 
  b) you probably run into the AUTO_INCREMENT problem. Make 
 sure that you
 have 5.0.20 at least. See 
 http://dev.mysql.com/doc/refman/5.0/en/replication-features.html
 for some docs.
 
 
  Best regards
  Henning
 
  --
  Henning P. Schmiedehausen  -- [EMAIL PROTECTED] | J2EE, Linux,
  91054 Buckenhof, Germany   -- +49 9131 506540 | Apache person
  Open Source Consulting, Development, Design | Velocity - Turbine guy
 
Save the cheerleader. Save the world.
 
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 Forio Business Simulations
 
 Will Glass-Husain
 [EMAIL PROTECTED]
 www.forio.com
 
 -
 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]



AW: Torque 4.0 - Add delete() / loadByPk(...) methods to Record object

2006-12-06 Thread Thoralf Rickert
So this would be shortcuts for *Peer.retrieveByPK and *Peer.delete(...)?

 -Ursprüngliche Nachricht-
 Von: Greg Monroe [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 5. Dezember 2006 20:10
 An: Apache Torque Developers List
 Betreff: Torque 4.0 - Add delete() / loadByPk(...) methods to 
 Record object
 
 
 I've often thought it would be nice for the 
 generated record object to have a delete() 
 and loadByPk() methods.  It would help 
 simplify a lot of code.
  
 Of course the loadByPK method would only be 
 added if there is a primary key.  And if there
 are multiple primary keys, the method sig. would 
 be something like:
  
 loadByPk( colType key1, colType key2...)
throw NoRowsException, TooManyRowsException
  
 and the delete() method would throw an exception
 if called on a new record.
 Greg Monroe [EMAIL PROTECTED] (919)680-5050
 CIS Solutions Team Lead
 Duke Corporate Education, Inc.
 333 Liggett St.
 Durham, NC 27701
 
 
  
 
 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]



[jira] Commented: (TORQUE-74) Targets sql and datasql can't find required files

2006-12-06 Thread Thoralf Rickert (JIRA)
[ 
http://issues.apache.org/jira/browse/TORQUE-74?page=comments#action_12456094 ] 

Thoralf Rickert commented on TORQUE-74:
---

I think, the sqldb.map file is generated when you call the sql ant-task. But 
I don't know why this file is necessary for the datadump task because it 
contains the files that are needed for the insert-sql task.

 Targets sql and datasql can't find required files
 -

 Key: TORQUE-74
 URL: http://issues.apache.org/jira/browse/TORQUE-74
 Project: Torque
  Issue Type: Bug
  Components: Generator
Affects Versions: 3.3
 Environment: Windows XP, JDK 1.5
Reporter: Joerg Friedrich

 I like to create an sql file from an XML data file I dumped using the 
 following sequence (%ANT_HOME% points to ant 1.6.4):
 CALL %ANT_HOME%\bin\ant  -f build-torque.xml jdbc %1 %2 %3
 mv .\src\schema\schema.xml .\src\schema\track-schema.xml
 CALL %ANT_HOME%\bin\ant -f build-torque.xml datadtd %1 %2 %3
 CALL %ANT_HOME%\bin\ant -f build-torque.xml datadump %1 %2 %3
 mv .\src\track-theUser-all-data.xml .\src\schema\track-data.xml
 (Yes, the moves are necessary since there are some precoded file names in 
 build-torque.xml).
 The following error appears:
 --- Nested Exception ---
 java.io.FileNotFoundException: D:\torque-gen-3.3-RC1\src\sql\sqldb.map (Das 
 System kann den angegebenen Pfad nicht finden)
 at java.io.FileInputStream.open(Native Method)
 I can't find the file anywhere in the source code (btw.: the source code 
 links at 
 http://www.apache.org/dyn/closer.cgi/db/torque/torque-3.3/source/torque-gen-3.3-src.zip
  are broken today).
 When I run the sql target, I get the following messages:
 at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
 Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to 
 find resource 'sql/base/firebird/table.vm'
 at 
 org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource
 (ResourceManagerImpl.java:501)
 And last but not least, beside these little problems, thanks for the superb 
 work, guys!

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: duplicate ID exception in cluster

2006-12-05 Thread Thoralf Rickert
Hi!

 I just set up a new 2 server cluster with two instances of 
 Tomcat both reading/writing from a single database.  I'm 
 using Torque 3.0, the default ID Broker and MySQL 5. (InnoDB)

It's not the answer for your question, but why do you use ID Broker with
MySQL? It has integrated auto incremention.

 My problem... Under heavy load, I notice that most write 
 requests on one of the servers fails with a duplicate ID 
 error.  Typically, each page request that fails does 10-20 
 insert statements.
 
 Any tips as to how I might make this cluster work with 
 simultaneous writes?

It sounds like one of your servers needs to much time between ID
generation and saving. Is the whole insert operation in a transaction or
can you do this?

T.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (TORQUE-71) custom velocity renderer to have nicely trimmed generated code

2006-12-05 Thread Thoralf Rickert (JIRA)
 [ http://issues.apache.org/jira/browse/TORQUE-71?page=all ]

Thoralf Rickert updated TORQUE-71:
--

Attachment: patch.txt

Okay, here is a first patch. I didn't test it, because I don't have a suitable 
test environment. What I did was to change the TorqueDataModelTask class. I've 
copied! the execute method from velocity-TexenTask class. Then I've changed the 
TemplateLoader for FileResourceLoader and ClasspathResourceLoader with my own 
loaders (which extends File- and ClasspathResourceLoader) and call the filter 
method (it uses streams now).

I'm not sure if the code compiles and runs because the Task uses two different 
StringUtils classes and I'm not sure, if I checked everything. AND I'm not sure 
if the template loader has any problems with the template syntax (see 
discussion in July). Please report any problems - I'll try to find the problem.

We use this filter here since last year in our own TemplateLoader which get's 
the templates from a database - so I'm sure that it works in principle but 
there could be one or more templates that has to be changed.

 custom velocity renderer to have nicely trimmed generated code
 --

 Key: TORQUE-71
 URL: http://issues.apache.org/jira/browse/TORQUE-71
 Project: Torque
  Issue Type: Improvement
  Components: Generator
Reporter: Thoralf Rickert
Priority: Minor
 Attachments: patch.txt


 The current Torque templates have spaces and tabs in front of Velocity 
 commands (#foreach, #set, #end,...). The Velocity renderer puts this spaces 
 and tabs into the generated code - that is the reason why the code in 
 generated Base* class files looks sometimes a little bit ugly. If we remove 
 the leading spaces in front of Velocity commands we can avoid this problem.
 My solution is to override the rendering method in 
 org.apache.velocity.texen.ant.TexenTask that Torque uses to render the 
 templates and replace the template loader with our own. Therefor we can 
 remove the leading spaces.
   /**
* This method filters the template and replaces some
* unwanted characters. For example it removes leading
* spaces in front of velocity commands and replaces
* tabs with spaces to prevent bounces in different
* code editors with different tab-width-setting.
*/
   protected byte[] filter(String template, String encoding) throws Exception {
 StringReader stringReader = new StringReader(template);
 LineNumberReader lineNumberReader = new LineNumberReader(stringReader);
 String line = null;
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 PrintStream ps = new PrintStream(baos,true,encoding);
 while ((line = lineNumberReader.readLine()) != null) {
   // remove leading spaces in front of velocity commands and comments
   line = line.replaceAll(^\\s*#, #);
   // replace tabs with spaces to prevent bounces in editors
   line = line.replaceAll(\t,);
   ps.println(line);
 }
 ps.flush();
 ps.close();
 return baos.toByteArray();
   }
 The only problem is, that this would generate an error if you use empty 
 statements in #if or #foreach commands, for example
   #if (something)
   #end
 This would create an error in velocity's render engine if you remove the 
 leading spaces - because empty statements are not allowed in Velocity. But 
 this can be avoided by add a single new line:
   #if (something)
   #end
 A patch for the current generator comes in the next days.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Aliases with Joins (was: Torque 4.0 plan)

2006-12-03 Thread Thoralf Rickert
Hi!
 
Some time ago we had a problem to map a very complicated SQL query to the 
Criteria object. In that query we made a join with one table twice - for 
example a foreignkey called invoice_address and a foreignkey 
delivery_address and both are mapped to the table address. The query needs 
to distinguish between invoice_address and delivery_address. So we need to use 
an alias in the join and selection part of the query.
 
The problem was, that criteria or the doSelect() throw an exception if you use 
an alias name instead of a normal Torque generated column name with a dot 
(TABLENAME.COLUMN_NAME) and we didn't understood what means Criteria.addAlias() 
and Criteria.getTableForAlias(). So, what we did, was to create an 
ExtendedCriteria that takes the Torque column name, removes the table name 
and replaces it with the alias name. Actually this isn't really something 
complicated but it helps us very much. 
 
public class EnhancedCriteria extends Criteria {

 
  public String getAliasedName(String name, String alias) {
String tableName = extractTableName(name);
String columnName = name.substring(tableName.length() + 1, name.length());
return alias + . + columnName;
  }

  public String extractTableName(String name) {
String result = null;
int index = name.lastIndexOf(.);
if (index  0) result = name.substring(0, index);
return result;
  }

To use this you can use something like this:
 
criteria.addJoin(
  criteria.getAliasedName(AddressPeer.ID, delivery_address), 
  ReceiptPeer.DELIVERY_ADDRESS_ID);
criteria.addJoin(
  criteria.getAliasedName(AddressPeer.ID, invoice_address), 
  ReceiptPeer.INVOICE_ADDRESS_ID);
...
criteria.add(criteria.getAliasedName(AddressPeer.LASTNAME,delivery_address,deliveredToLastname);
...
ReceiptPeer.addSelectColumn(criteria,invoice_address);
 
The addSelectColumn(Criteria criteria, String alias) extends the standard 
addSelectColumn() method and calls the getAliasedName() for every existing 
column (template extension). Of course this is just an easy example of our real 
SQL query.
 
But if you think about redesigning the way to hold the column name in Torque 
4.0, you should also think about a way to use aliases in queries and think 
about Criteria methods that expect an alias name instead of a column name. I 
hope, our extension is just the first step for a change in the Torque API.
 
Thoralf
 
 


Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
Gesendet: Sa 02.12.2006 11:21
An: Apache Torque Developers List
Betreff: Aliases with Joins (was: Torque 4.0 plan)



Hi Thoralf,

When you have time, could you describe what you did there ?

 Thomas

On Fri, 1 Dec 2006, Thoralf Rickert wrote:

 I forgot something: We've implemented a working and easy way to use Aliases 
 with JOINs. This is necessary if you join a table twice.


-
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]

[jira] Created: (TORQUE-71) custom velocity renderer to have nicely trimmed generated code

2006-12-03 Thread Thoralf Rickert (JIRA)
custom velocity renderer to have nicely trimmed generated code
--

 Key: TORQUE-71
 URL: http://issues.apache.org/jira/browse/TORQUE-71
 Project: Torque
  Issue Type: Improvement
  Components: Generator
Reporter: Thoralf Rickert
Priority: Minor


The current Torque templates have spaces and tabs in front of Velocity commands 
(#foreach, #set, #end,...). The Velocity renderer puts this spaces and tabs 
into the generated code - that is the reason why the code in generated Base* 
class files looks sometimes a little bit ugly. If we remove the leading spaces 
in front of Velocity commands we can avoid this problem.

My solution is to override the rendering method in 
org.apache.velocity.texen.ant.TexenTask that Torque uses to render the 
templates and replace the template loader with our own. Therefor we can remove 
the leading spaces.

  /**
   * This method filters the template and replaces some
   * unwanted characters. For example it removes leading
   * spaces in front of velocity commands and replaces
   * tabs with spaces to prevent bounces in different
   * code editors with different tab-width-setting.
   */
  protected byte[] filter(String template, String encoding) throws Exception {
StringReader stringReader = new StringReader(template);
LineNumberReader lineNumberReader = new LineNumberReader(stringReader);
String line = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos,true,encoding);

while ((line = lineNumberReader.readLine()) != null) {
  // remove leading spaces in front of velocity commands and comments
  line = line.replaceAll(^\\s*#, #);
  // replace tabs with spaces to prevent bounces in editors
  line = line.replaceAll(\t,);
  ps.println(line);
}
ps.flush();
ps.close();

return baos.toByteArray();
  }

The only problem is, that this would generate an error if you use empty 
statements in #if or #foreach commands, for example
  #if (something)
  #end

This would create an error in velocity's render engine if you remove the 
leading spaces - because empty statements are not allowed in Velocity. But this 
can be avoided by add a single new line:

  #if (something)

  #end


A patch for the current generator comes in the next days.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Java5 (was: Torque 4.0 plan)

2006-12-03 Thread Thoralf Rickert
I don't have an idea of how can we support JDK1.5 and JDK1.4 because of the 
compatibility problems between 1.4 and 1.5 - but I think like Thomas that we 
have to make a break. The next release of the JDK is on the way and we're still 
programing in the old 1.4. I don't want to start a principle discussion - I 
know that many developers cannot easily switch to a new JDK.
 
Currently we have the best solution for 1.4 and 1.5. If you change a switch and 
rerun the generator you have JDK1.5 compatible generated classes. Maybe there 
are some places in the templates that could be more Java5 compatible (foreach, 
generics, enums). But this would change the API very much and the underlying 
Torque-API uses still just JDK1.4. A new major release could be a good moment 
to think about this API changes. Removing Village means in any case that 
existing projects have to be reviewed before switching to Torque 4.0. 
 
The only disadvantage I can think about is, that projects that cannot switch to 
JDK1.5 don't have access to the new features that we plan to implement and we 
have to backport bugfixes to the 3.x tree if we find some in Torque. Because we 
cannot say Switch to Torque 4.0 if you have a problem.
 
What about the Tomcat solution. They have a 5.0 tree for Java5 system and a 
5.5 tree for =Java5 system. I don't know how they manage this, because this 
means they have two branches. Does somebody know how they do this?
 
Thoralf
 




From: Thomas Fischer
 
[...]
Problematic:

- Use Java 5 style generics and enumerations. Java 5 code does not run on
  jdk 1.4

[...]

You are right, I was not aware of this. So what do we do ? I'd guess most 
people will use java 1.5 by the time the new release is ready (I do not 
think less than a year's development time is realistic), but I'm also sure 
there are some users who cannot use Java 1.5. 

Supporting 1.5 in the generator is the minimum option (we have that 
already), but my original idea was to port the runtime and the other stuff 
as well. 

I'd guess if we do not do it in the step towards 4.0 we'll never make that 
transition. 

I'm undecided. Any opinions ? 

 Thomas 

[...]



From: Jonathan Purvis

 - Use Java 5 style generics and enumerations. One can use compiler 
 settings to produce pre-1.5-executable class files. 

The autoboxing in 1.5 of int to Integer uses Integer.valueOf(int), 
which doesn't exist in 1.4.  Also, javac won't let you: 

  $ javac -target 1.4 Generic.java 
  javac: target release 1.4 conflicts with default source release 1.5 

  $ javac -target 1.4 -source 1.5 Generic.java 
   javac: source release 1.5 requires target release 1.5 

Could it be an option on the generator instead? 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

AW: Custom Velocity Renderer (was: Torque 4.0 plan)

2006-12-02 Thread Thoralf Rickert
Hi!
 
I'll do this at the end of next week - because I've lot of work on my desk at 
the moment.
 
bye
Thoralf



Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
Gesendet: Sa 02.12.2006 10:13
An: Apache Torque Developers List
Betreff: Custom Velocity Renderer (was: Torque 4.0 plan)



Hi Thoralf,

would you mind to put this into jira as enhancement ? If I recall
correctly, you have done this already, so a diff against the current svn
version would be gerat.

 Thomas

On Thu, 30 Nov 2006, Thoralf Rickert wrote:
 ...
 Another small topic is my suggestion some months ago (July, 10.) to
 replace the ant velocity render task with our own velocity render task
 to remove leading spaces in front of velocity statements (__#foreach
 ...). Therefore we have to rewrite some lines in
 org.apache.velocity.texen.ant.TexenTask which we extend. This works here
 for my XHTML generation very good. Maybe there are some other features
 that could be possible with our own velocity renderer.

-
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]

AW: Torque 4.0 plan

2006-12-01 Thread Thoralf Rickert
I forgot something: We've implemented a working and easy way to use Aliases 
with JOINs. This is necessary if you join a table twice. And the Add full 
support for views is something that would be very useful.

T.

 -Ursprüngliche Nachricht-
 Von: Greg Monroe [mailto:[EMAIL PROTECTED] 
 Gesendet: Donnerstag, 30. November 2006 17:29
 An: Apache Torque Developers List
 Betreff: RE: Torque 4.0 plan
 
 
  Thomas Fischer said:
  
  Now that the first Torque RC is outit is time to think about
  what we'd like to do as next version. Personally, I'd like 
  to propose the following:
  
 
 Can't complain about that list.  Only +0 items I'd list
 would be on the Maven 2 conversion and the generic generator.
 
  - Switch to Maven 2 as build system. Maven 2 has much better 
multiproject support than Maven 1, so building will be 
easier.
 
 My +0 for Maven 2 is based on the little bit I dug into it 
 for the add-on stuff. It seemed to add a lot of complication 
 and extra more effort to do thing outside the Maven 2 norm 
 that was fairly easy in 1.  IMHO, build systems should take a 
 minimum of time away from your development time, not become 
 a subproject of it's own.  
 
 But to be fair, it could be I just didn't take the time to 
 learn it well enough. But if someone else is doing the work ;)  
 who am I to complain...lol
 
  - Make the generator more generic. I'd like to turn the 
generator into a generic code generation tool
 
 I'm +0 on the idea of the generic generator.  I can see the
 worth in this, but I'm not sure it's a core Torque thing. 
 It seems like this should be like Torque and Turbine, some
 of the ground work layed here but with a plan to split it
 off into a separate project.  Plus, is this competing with
 Velocity/Texen?  None of this is a show stopper, just thoughts
 for fine tuning the proposal.
 
 Here's some idea's I'll throw in the ring:
 
 Better support for non-record type queries.  I.e., the 
 stuff people do with executeQuery / Village Records.  Queries
 of this type that come to mind are:
 
 - Optimized Join queries that return data from multiple 
   tables (for creating master lists).
 
 - Queries with functions.
 
 To support this and also assist in the Village exorcism,
 I'd propose making the BaseObject an actual storage 
 implimentation, like Village Record or ResultsSet.  Internally
 the data would be stored as objects in OrderedMap with the 
 getBy/setBy methods being the BaseObject access points.
 
 This would allow executeQuery to return a list of BaseObject
 records.
 
 Additionally, the generated record objects could make use
 of this new base class to support things like isNull() on
 primitives.  We could also use this to track modified and
 unmodified column values, which would be very useful (e.g.
 updating tables without primary keys). 
 
 Take a serious look at DDLUtils integration, and maybe do 
 a little encouraging to get that project to do a release/
 Maven repo set up.
 
 Some stuff that may be V4.5 features but might be nice to 
 start planning for:
 
 Add full support for views, since most of the common DBs
 support them. E.g., a way to define them in the DTD, 
 support for creation, etc.
 
 Look at being able to generate object level views.  E.g., 
 I'm always creating wrapper objects that are based on 
 subsets of data from two or more related tables, with access, 
 load, and store methods.  I'm thinking this would be a way 
 to define business objects via XML and have them generated.
   
 Support for lazy record object population.  Sometimes it's
 better to retrieve a set of partially filled objects (e.g. 
 doing a master list), and only totally fill the object when
 needed.  Adding an isLoaded option to the isNull, isModified,
 column level tracking would make this fairly easy.
 
 A GUID based idBroker method to autogenerate keys without
 needing access to a table.
 
 
 
 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]
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Torque 4.0 plan

2006-11-30 Thread Thoralf Rickert
Hi!

 []
 - Use Java 5 style generics and enumerations. One can use compiler 
 settings to produce pre-1.5-executable class files.

Oh yes. I will be glad to help on this topic.

Another small topic is my suggestion some months ago (July, 10.) to
replace the ant velocity render task with our own velocity render task
to remove leading spaces in front of velocity statements (__#foreach
...). Therefore we have to rewrite some lines in
org.apache.velocity.texen.ant.TexenTask which we extend. This works here
for my XHTML generation very good. Maybe there are some other features
that could be possible with our own velocity renderer.

bye
Thoralf





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Best Solution for Column Compares

2006-10-23 Thread Thoralf Rickert
Hi!

What is the best solution to compare two columns in a criteria? Or is a
CUSTOM-Criteria in

 
criteria.add(COLUMN_A,(Object)(COLUMN_A+=+COLUMN_B),Criteria.CUSTOM);

the only possible solution (using plain SQL) or is there something
better?

bye
Thoralf


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Best Practice: Column Compares

2006-10-23 Thread Thoralf Rickert
Hi!

What is the best solution to compare two columns in a criteria?
Or is a CUSTOM-Criteria in

 
criteria.add(COLUMN_A,(Object)(COLUMN_A+=+COLUMN_B),Criteria.CUSTOM);

the only possible solution (using plain SQL) or is there something
better?

bye
Thoralf


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Problems to set up a subquery

2006-10-20 Thread Thoralf Rickert

 Sort of a clean approach, but not working due sql exections:
 [...]
   criteria.addNotIn(KundenadressePeer.KUNDENADRESS_ID, 
 AdressenreferenzPeer.doSelect(subCriteria));
 [...]

Just a question because I'm not sure if you just show an example or the
real code, that you're using. The doSelect() method in your addNotIn()
returns a list of Adressreferenz objects. If you put this into a
addNotIn - I think the query-generation-process uses the String
representation of these Adressreferenz objects to create the sql-query.
Did you overwrite the toString() method in Adressreferenz? I'm not sure,
if you have to do this, but my Torque version (3.2) uses toString() to
create the query. The generated toString() method in BaseAdressreferenz
is nice for debugging but useless for sql-queries, I think.

bye
Thoralf


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Problems to set up a subquery

2006-10-20 Thread Thoralf Rickert
You have three options:

Overwrite toString and return the KundenaddressId that is set in the reference 
(because that is what you want).

The other solution is to make a doSelectVillageRecords (that returns only the 
columns that you have ask for with subCriteria.addSelectColumn()). The 
doSelectVillageRecords would return a list of Village Record objects. But you 
don't have access to the toString() method, so you have to extract the values 
in an extra array...

The third method is to use a join.

The third method seems to be the best, because everything else results in two 
select queries (first to get Adressreferenz Ids and then to make the IN-Query).

 -Ursprüngliche Nachricht-
 Von: Pfiester, Jan [mailto:[EMAIL PROTECTED] 
 Gesendet: Freitag, 20. Oktober 2006 12:18
 An: Apache Torque Users List
 Betreff: AW: Problems to set up a subquery
 
 
 Well, it is some real code...
 
  Did you overwrite the toString() method in Adressreferenz?
 No, I did'nt.  
 
   but my Torque version (3.2) uses toString() to create the 
 query. The 
   generated toString() method in BaseAdressreferenz is nice for 
  debugging but useless for sql-queries...
 
 So what are you doing in the overwritten toString() method?
 Do you just build together a subselect-querystring 
 arrayobject according to the returned result objects? Don't 
 you have to hard code row references again (see the 
 custom-tag), which is what i'm trying to avoid.
 
 Bye
 Jan
 
 
 -Ursprüngliche Nachricht-
 Von: Thoralf Rickert [mailto:[EMAIL PROTECTED] 
 Gesendet: Freitag, 20. Oktober 2006 11:24
 An: Apache Torque Users List
 Betreff: AW: Problems to set up a subquery
 
 
  Sort of a clean approach, but not working due sql exections: [...]
  criteria.addNotIn(KundenadressePeer.KUNDENADRESS_ID,
  AdressenreferenzPeer.doSelect(subCriteria));
  [...]
 
 Just a question because I'm not sure if you just show an 
 example or the real code, that you're using. The doSelect() 
 method in your addNotIn() returns a list of Adressreferenz 
 objects. If you put this into a addNotIn - I think the 
 query-generation-process uses the String representation of 
 these Adressreferenz objects to create the sql-query. Did you 
 overwrite the toString() method in Adressreferenz? I'm not 
 sure, if you have to do this, but my Torque version (3.2) 
 uses toString() to create the query. The generated toString() 
 method in BaseAdressreferenz is nice for debugging but 
 useless for sql-queries, I think.
 
 bye
 Thoralf
 
 
 -
 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]
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (TORQUE-59) correctBooleans() overwrites complex boolean criteria

2006-10-09 Thread Thoralf Rickert (JIRA)
correctBooleans() overwrites complex boolean criteria
-

 Key: TORQUE-59
 URL: http://issues.apache.org/jira/browse/TORQUE-59
 Project: Torque
  Issue Type: Bug
  Components: Runtime
Affects Versions: 3.2
 Environment: MySQL 5
Reporter: Thoralf Rickert


If you have a table with a nullable boolean column:

  column name=test type=booleanint size=1/

and create a criteria like this:

Criterion c1 = criteria.getNewCriterion(TEST, false, Criteria.EQUAL);
Criterion c2 = criteria.getNewCriterion(TEST, null, Criteria.ISNULL);
criteria.add(c1.or(c2));

then the createQueryString returns the correct toString() result with

   ...WHERE (TEST = 0 or TEST IS NULL) ...

but when you call doSelect(), it sends just TEST = 0 to the database.

The problem is in the generated correctBooleans(Criteria) method. It checks if 
the Criteria contains one of the boolean column and replaces the criterion with 
an int value. So, in the above situation it removes the Criteria.ISNULL 
part...that is not expected.

   .
   if (criteria.containsKey(TEST))
{
Object possibleBoolean = criteria.get(TEST);
if (possibleBoolean instanceof Boolean)
{
criteria.add(TEST, ((Boolean) possibleBoolean).booleanValue() ? 
1 : 0);
}
 }

The only possible workaround is to use the integer value (0,1) in the criterion 
(Criterion c1 = criteria.getNewCriterion(TEST, 0, Criteria.EQUAL) ). But this 
is not expected, because it is database specific.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Oracle - Null and Zero-length string problem

2006-10-06 Thread Thoralf Rickert
Just one idea - I'm not using Oracle - but what about:

  (column = '' OR column IS NULL)

In Torque

  Criteria.Criterion c1 = criteria.getNewCriterion(COLUMN, , Criteria.EQUAL);
  Criteria.Criterion c2 = criteria.getNewCriterion(COLUMN, (Object)null, 
Criteria.ISNULL);
  criteria.add(c1.or(c2));

? Does this work in Oracle. In MySQL this isn't a problem.


 -Ursprüngliche Nachricht-
 Von: Parthasarathy Thandavarayan 
 [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 3. Oktober 2006 06:18
 An: torque-user@db.apache.org
 Betreff: Oracle - Null and Zero-length string problem
 
 
 Hi all,
 
 I am working on an framework that uses torque 3.2 as the ORM 
 layer. Everything works perfectly on MySQL 4.1 and I am right 
 now trying to make it work on Oracle 10g also. One of the 
 problems i am facing is with respect to the difference in the 
 way oracle handles zero-length strings ('') when compared to 
 other dbs. In oracle zero-length strings are treated as null. 
 If we are inserting '' in a column and query it back with 
 where clause -- where column = ''  no rows will be 
 returned. We should rather query it with the where clause -- 
 where column is null. 
 On other dbs for eg., MySQL 4.1 the where clause condition 
 should be -- where column = ''. 
 
 If I change the where clause to IS NULL then the app wont 
 work on MySQL.. If I retain it as '' then it wont work on 
 Oracle. Can anyone help me with a solution or workaround for this? 
 
 One possible way to make it work is by changing the 
 SQLExpression class to convert the criteria to null from '' 
 if the db is oracle. Is there anyother way to make this work? 
 the only restriction is that the same where clause should 
 work on all dbs
 
 
 Thanks,
 
 Sarathy
 
  
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Oracle - Null and Zero-length string problem

2006-10-06 Thread Thoralf Rickert
 Why cannot we write a code in this method which simply says - 
  if db is of type dboracle and if criteria= then criteria is null

Maybe because nobody wrote a patch or a jira issue. :)

http://issues.apache.org/jira/browse/TORQUE



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Old torque bugs from scarab

2006-10-06 Thread Thoralf Rickert
I think it is better to have just one jira Key for Torque. It isn't so 
confusing. It is easier to get an overview. And it isn't understandable why 
there is an OLD key, just because the bugs in it are imported from Scarab.


 -Ursprüngliche Nachricht-
 Von: Thomas Fischer [mailto:[EMAIL PROTECTED] 
 Gesendet: Samstag, 30. September 2006 09:20
 An: torque-dev@db.apache.org
 Betreff: Old torque bugs from scarab
 
 
 Jeff turner has imported the old bugs from Scarab into jira, 
 they can be 
 found in
 
 http://issues.apache.org/jira/browse/TORQUEOLD
 
 The question si now whether they should be left under a 
 separate key, or 
 whether the issues should be bulk moved to the current Torque project.
 
 I have started to look through the open issues (beware: you 
 cannot use 
 the standard outstanding filter, as the resolution is set to 
 unresolved for all issues which were not changed in the 
 meantime), and 
 resolved those which are fixed, and set those to wontfix which make 
 suggestions which do not fit into current Torque 
 architecture. If you do 
 not agree with a change I have made, please complain.
 
 Note:currently no change mails are sent to the torque mailing 
 lists, so 
 whenever you want to discuss something, also mail to 
 torque-dev to direct 
 people to the spot.
 
 Note2: Many things (e.g. comments, attachments) were lost in the 
 export/import process, becaause the old version of scarab we 
 were using 
 left out many fields on the TSV export.
 
 My personal impression is that many things are still relevant 
 to Torque, 
 but most are things which should be hcanged and not many 
 explicit bugs. 
 So I'm still divided whether we should keep the old issues 
 separate or 
 not. Any opinions ?
 
 Thomas
 
 P.S. I'm away on vacation next week. I'lll look though the remaining 
 issues when I'm back.
 
 
 -
 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]



Bug#386497: linux-image-2.6.17-2-686: oops on boot

2006-09-29 Thread Thoralf Rickert
I've the same problem with an AMD/nforce2 on a german STRATO rootserver
(sarge testing).

Linux version 2.6.17-2-k7 (Debian 2.6.17-9) ([EMAIL PROTECTED]) (gcc
version 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)) #1 SMP Wed Sep 13
17:18:46 UTC 2006
...
BUG: unable to handle kernel NULL pointer dereference at virtual address
000c
 printing eip:
b0202352
*pde = 
Oops:  [#1]
SMP 
Modules linked in: i2c_nforce2 psmouse evdev i2c_core serio_raw pcspkr
ohci_hcd tg3 ehci_hcd 8250_pnp usbcore rtc ext3 jbd mbcache ide_disk
ide_generic via82cxxx trm290 triflex slc90e66 sis5513 siimage
serverworks sc1200 rz1000 piix pdc202xx_old opti621 ns87415 it821x
hpt366 hpt34x generic cy82c693 cs5535 cs5530 cs5520 cmd64x atiixp
amd74xx alim15x3 aec62xx pdc202xx_new ide_core raid1 md_mod
CPU:0
EIP:0060:[b0202352]Not tainted VLI
EFLAGS: 00010206   (2.6.17-2-k7 #1) 
EIP is at uart_write_room+0x9/0x16
eax: b1bf3800   ebx: 0006   ecx: efb26540   edx: 
esi: ef6b3000   edi: ef0e6400   ebp: 0006   esp: efaf1f18
ds: 007b   es: 007b   ss: 0068
Process S03udev (pid: 1058, threadinfo=efaf task=efb26540)
Stack: b01f6591 ef0e6400 ef55ca40 0282  efb26540 b0116fb2
ef6b3138 
   ef6b3138 0006 ef6b3000 0006 0006 b01f41ed 0006
080f6408 
   ef55ca40 b01f64b0 ef6b300c ef6b33e8  b01f4a62 ef55ca40
ef55ca40 
Call Trace:
 b01f6591 write_chan+0xe1/0x293  b0116fb2
default_wake_function+0x0/0xc
 b01f41ed tty_write+0x147/0x1d8  b01f64b0 write_chan+0x0/0x293
 b01f4a62 redirected_tty_write+0x1c/0x6b  b01f4a46
redirected_tty_write+0x0/0x6b
 b0153770 vfs_write+0xa1/0x140  b0153d5a sys_write+0x3c/0x63
 b0102b5b syscall_call+0x7/0xb 
Code: 09 08 8b 40 10 74 09 81 60 10 ff ff ff fd eb 07 81 48 10 00 00 00
02 8b 5e 68 89 f0 ff 53 2c 5b 5e c3 8b 80 80 01 00 00 8b 50 10 8b 42
0c 2b 42 08 48 25 ff 0f 00 00 c3 8b 80 80 01 00 00 8b 50 
EIP: [b0202352] uart_write_room+0x9/0x16 SS:ESP 0068:efaf1f18




Bug#386497: linux-image-2.6.17-2-686: oops on boot

2006-09-29 Thread Thoralf Rickert
I've the same problem with an AMD/nforce2 on a german STRATO rootserver
(sarge testing).

Linux version 2.6.17-2-k7 (Debian 2.6.17-9) ([EMAIL PROTECTED]) (gcc
version 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)) #1 SMP Wed Sep 13
17:18:46 UTC 2006
...
BUG: unable to handle kernel NULL pointer dereference at virtual address
000c
 printing eip:
b0202352
*pde = 
Oops:  [#1]
SMP 
Modules linked in: i2c_nforce2 psmouse evdev i2c_core serio_raw pcspkr
ohci_hcd tg3 ehci_hcd 8250_pnp usbcore rtc ext3 jbd mbcache ide_disk
ide_generic via82cxxx trm290 triflex slc90e66 sis5513 siimage
serverworks sc1200 rz1000 piix pdc202xx_old opti621 ns87415 it821x
hpt366 hpt34x generic cy82c693 cs5535 cs5530 cs5520 cmd64x atiixp
amd74xx alim15x3 aec62xx pdc202xx_new ide_core raid1 md_mod
CPU:0
EIP:0060:[b0202352]Not tainted VLI
EFLAGS: 00010206   (2.6.17-2-k7 #1) 
EIP is at uart_write_room+0x9/0x16
eax: b1bf3800   ebx: 0006   ecx: efb26540   edx: 
esi: ef6b3000   edi: ef0e6400   ebp: 0006   esp: efaf1f18
ds: 007b   es: 007b   ss: 0068
Process S03udev (pid: 1058, threadinfo=efaf task=efb26540)
Stack: b01f6591 ef0e6400 ef55ca40 0282  efb26540 b0116fb2
ef6b3138 
   ef6b3138 0006 ef6b3000 0006 0006 b01f41ed 0006
080f6408 
   ef55ca40 b01f64b0 ef6b300c ef6b33e8  b01f4a62 ef55ca40
ef55ca40 
Call Trace:
 b01f6591 write_chan+0xe1/0x293  b0116fb2
default_wake_function+0x0/0xc
 b01f41ed tty_write+0x147/0x1d8  b01f64b0 write_chan+0x0/0x293
 b01f4a62 redirected_tty_write+0x1c/0x6b  b01f4a46
redirected_tty_write+0x0/0x6b
 b0153770 vfs_write+0xa1/0x140  b0153d5a sys_write+0x3c/0x63
 b0102b5b syscall_call+0x7/0xb 
Code: 09 08 8b 40 10 74 09 81 60 10 ff ff ff fd eb 07 81 48 10 00 00 00
02 8b 5e 68 89 f0 ff 53 2c 5b 5e c3 8b 80 80 01 00 00 8b 50 10 8b 42
0c 2b 42 08 48 25 ff 0f 00 00 c3 8b 80 80 01 00 00 8b 50 
EIP: [b0202352] uart_write_room+0x9/0x16 SS:ESP 0068:efaf1f18




[jira] Commented: (TORQUE-44) Column names in generated classes are uppercase

2006-09-14 Thread Thoralf Rickert (JIRA)
[ 
http://issues.apache.org/jira/browse/TORQUE-44?page=comments#action_12434608 ] 

Thoralf Rickert commented on TORQUE-44:
---

I think, the uppercase table names was a bug. It looks like a copypaste error. 
So, if you wish to have a switch, it should be the other way round - enable the 
switch to have uppercase table names. 

But I'm not sure if it is useful to have such a switch - we have a lot of them. 
Where is the problem in your example? If you compare torque table name 
constants with a database table cell content you can use methods to make the 
constants uppercase (in SQL or in Java). Of course - you have to change your 
code. But I think, you shouldn't use the internal Torque table name constants. 
I think, they are just for generating appropriate SQL query statements.

 Column names in generated classes are uppercase
 ---

 Key: TORQUE-44
 URL: http://issues.apache.org/jira/browse/TORQUE-44
 Project: Torque
  Issue Type: Bug
  Components: Generator
Affects Versions: 3.1, 3.1.1, 3.2
Reporter: Thoralf Rickert
 Assigned To: Thomas Fischer
 Fix For: 3.2.1

 Attachments: patch.txt


 The generator creates constants for the column names in tables. The content 
 of this constants uses upper cases.
 For example if you have a table like:
 table name=address
 column name=class javaName=aClass primaryKey=true 
 required=true size=2 type=CHAR/
 column name=id primaryKey=true required=true size=30 
 type=VARCHAR/
 column name=position primaryKey=true required=true 
 type=INTEGER/
 column name=name1 size=50 type=VARCHAR/
 column name=name2 size=50 type=VARCHAR/
 column name=name3 size=50 type=VARCHAR/
 column name=street size=50 type=VARCHAR/
 column name=zipcode size=25 type=VARCHAR/
 column name=city size=60 type=VARCHAR/
 column name=phone size=40 type=VARCHAR/
 column name=phone2 size=40 type=VARCHAR/
 column name=country size=200 type=VARCHAR/
 column name=state size=200 type=VARCHAR/
 column name=fax size=40 type=VARCHAR/
 column name=email size=150 type=VARCHAR/
 /table
 The generator creates in the corresponding BaseAddressPeer the following 
 constants.
 ...
 static
 {
   CLASS = address.CLASS;
   ID = address.ID;
   POSITION = address.POSITION;
   NAME1 = address.NAME1;
   NAME2 = address.NAME2;
   NAME3 = address.NAME3;
   STREET = address.STREET;
   ZIPCODE = address.ZIPCODE;
   CITY = address.CITY;
   PHONE = address.PHONE;
   PHONE2 = address.PHONE2;
   COUNTRY = address.COUNTRY;
   STATE = address.STATE;
   FAX = address.FAX;
   EMAIL = address.EMAIL;

 but this variables should be for example address.email.
 The AddressMapBuilder.doBuild() method creates the same uppercase mapping:
   public void doBuild() throws TorqueException {
 ...
 dbMap.addTable(address);
 TableMap tMap = dbMap.getTable(address);
 tMap.setPrimaryKeyMethod(none);
 tMap.addPrimaryKey(address.CLASS,  );
 tMap.addPrimaryKey(address.ID,  );
 tMap.addPrimaryKey(address.POSITION, new Integer(0) );
 tMap.addColumn(address.NAME1, , 50 );
 tMap.addColumn(address.NAME2, , 50 );
 tMap.addColumn(address.NAME3, , 50 );
 tMap.addColumn(address.STREET, , 50 );
 tMap.addColumn(address.ZIPCODE, , 25 );
 tMap.addColumn(address.CITY, , 60 );
 tMap.addColumn(address.PHONE, , 40 );
 tMap.addColumn(address.PHONE2, , 40 );
 tMap.addColumn(address.COUNTRY, , 200 );
 tMap.addColumn(address.STATE, , 200 );
 tMap.addColumn(address.FAX, , 40 );
 tMap.addColumn(address.EMAIL, , 150 );
 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (TORQUE-51) Wrong Link on Download Page

2006-08-13 Thread Thoralf Rickert (JIRA)
Wrong Link on Download Page
---

 Key: TORQUE-51
 URL: http://issues.apache.org/jira/browse/TORQUE-51
 Project: Torque
  Issue Type: Bug
Reporter: Thoralf Rickert
Priority: Trivial


The is a wrong link on http://db.apache.org/torque/download.html

The link to the web interface of SVN is not 

   http:svn.apache.org/viewcvs/db/torque

but

  http://svn.apache.org/viewcvs/db/torque

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Commented: (TORQUE-49) Encoding will not be used in insert-sql if it is used in generation task

2006-08-13 Thread Thoralf Rickert (JIRA)
[ 
http://issues.apache.org/jira/browse/TORQUE-49?page=comments#action_12427744 ] 

Thoralf Rickert commented on TORQUE-49:
---

Okay, but then is the sql output of torque incorrect because it is generated in 
the encoding of the xml schema. My platform encoding is cp1251 or ISO 8859-1 
but the xml schema is in UTF-8. The generated sql output is still in UTF-8 and 
not converted to cp1251 or ISO 8859-1. 

If Torque should use the current platform encoding for the generated files the 
sql and om tasks are buggy. Both generate files in the encoding of the XML 
schema file. 

They mix the encoding of the XML file and the encoding of the Torque templates. 
I'Ve tried the following test:

 - Add a special ISO-8859-1 character (for example a german umlaut) in the 
Torque template (for example Peer.vm)
 - Add a special UTF-8 character (another umlaut) in the UTF-8 encoded XML 
schema (for example a table description)
 - Generate the Peers and Objects classes. The description of the table should 
be added to the classes comment
 - The generated Peer has a ISO-8859-1 character and a UTF-8 character.

Of course this is a special condition because the torque templates are normally 
in english and all characters can be mapped to the ASCII encoding which is a 
subset of ISO-8859-1 and UTF-8. So you normally don't have problems with 
special characters.

But the fact is that torque ignores the encoding of the XML file. It should 
check the encoding of the XML file and convert it to the platform encoding (or 
better to the Torque template encoding). I had a lot of fun in the last months 
with character encoding in Java IO. This isn't trivial if you don't use the 
current platform encoding. Unicode doesn't help if you read and write text 
from/to files and ignore the encoding of them. 



 Encoding will not be used in insert-sql if it is used in generation task
 

 Key: TORQUE-49
 URL: http://issues.apache.org/jira/browse/TORQUE-49
 Project: Torque
  Issue Type: Bug
  Components: Generator
Affects Versions: 3.2
Reporter: Thoralf Rickert
Priority: Trivial

 My schema.xml is encoded in UTF-8 and torque generates a SQL file in UTF-8. 
 But when I run insert-sql the TorqueSQLExec task decodes the file with the 
 system encoding because it doesn't know that the SQL file was encoded in 
 UTF-8.
 My current solution is to set the attribute encoding=UTF-8 in the 
 torque-sql-exec task call in my build-torque.xml.
 But I think torque should know the encoding of the files that it generates. 
 It could be set (for example) in the sqldb.map file or by using special 
 filename extension like .utf8.sql

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (TORQUE-49) Encoding will not be used in insert-sql if it is used in generation task

2006-08-04 Thread Thoralf Rickert (JIRA)
Encoding will not be used in insert-sql if it is used in generation task


 Key: TORQUE-49
 URL: http://issues.apache.org/jira/browse/TORQUE-49
 Project: Torque
  Issue Type: Bug
  Components: Generator
Reporter: Thoralf Rickert
Priority: Trivial


My schema.xml is encoded in UTF-8 and torque generates a SQL file in UTF-8. But 
when I run insert-sql the TorqueSQLExec task decodes the file with the system 
encoding because it doesn't know that the SQL file was encoded in UTF-8.

My current solution is to set the attribute encoding=UTF-8 in the 
torque-sql-exec task call in my build-torque.xml.

But I think torque should know the encoding of the files that it generates. It 
could be set (for example) in the sqldb.map file or by using special filename 
extension like .utf8.sql


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (TORQUE-49) Encoding will not be used in insert-sql if it is used in generation task

2006-08-04 Thread Thoralf Rickert (JIRA)
 [ http://issues.apache.org/jira/browse/TORQUE-49?page=all ]

Thoralf Rickert updated TORQUE-49:
--

Affects Version/s: 3.2

 Encoding will not be used in insert-sql if it is used in generation task
 

 Key: TORQUE-49
 URL: http://issues.apache.org/jira/browse/TORQUE-49
 Project: Torque
  Issue Type: Bug
  Components: Generator
Affects Versions: 3.2
Reporter: Thoralf Rickert
Priority: Trivial

 My schema.xml is encoded in UTF-8 and torque generates a SQL file in UTF-8. 
 But when I run insert-sql the TorqueSQLExec task decodes the file with the 
 system encoding because it doesn't know that the SQL file was encoded in 
 UTF-8.
 My current solution is to set the attribute encoding=UTF-8 in the 
 torque-sql-exec task call in my build-torque.xml.
 But I think torque should know the encoding of the files that it generates. 
 It could be set (for example) in the sqldb.map file or by using special 
 filename extension like .utf8.sql

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Sybase case insensitive column names

2006-07-20 Thread Thoralf Rickert
Thanks. I think, that's what I couldn't find.

 -Ursprüngliche Nachricht-
 Von: Greg Monroe [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 19. Juli 2006 23:59
 An: Apache Torque Users List
 Betreff: RE: Sybase case insensitive column names
 
 
 FWIW - Doing some quick research I found that Sybase can 
 almost meet the SQL standards by setting the sort order to 
 case insensitive.
 
 See:
 
 http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.
 dc36556_1500/html/histserv/title.htm 
 
  -Original Message-
  From: Greg Monroe [mailto:[EMAIL PROTECTED]
  Sent: Monday, July 17, 2006 3:27 PM
  To: Apache Torque Users List
  Subject: RE: Sybase case insensitive column names
  
  
  Just a couple of quick comments.  According to a quick read
  of the SQL 99 standard, column names are supposed to be case 
  insensitive unless they are delimited.  Sybase is doing 
  non-standard things here (or my interpretation could be 
  wrong  8) ) 
  
  Also, changing the way Torque has generated column names 
 since day one 
  could possibly break (badly written) application code if 
 someone has 
  hardcoded this expected behaviour into it.
  
  Should this be an optional generation flag?
  
   -Original Message-
   From: Thoralf Rickert [mailto:[EMAIL PROTECTED]
   Sent: Monday, July 17, 2006 4:45 AM
   To: Apache Torque Users List
   Subject: AW: Sybase case insensitive column names
   
   Okay, I'll submit a bug report.
   
-Ursprüngliche Nachricht-
Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 17. Juli 2006 10:04
An: Apache Torque Users List
Betreff: AW: Sybase case insensitive column names


The column names in the class files should be generated
  in the same
case as they appear in the schema file. If this is not the
   case, this
is a bug. This is Torque 3.2 and you did not change
   anything there, I
assume ? If yes, would you mind to submit a bug report to Jira ?

   Thomas

Thoralf Rickert [EMAIL PROTECTED] schrieb am
  17.07.2006
09:19:17:

 That is correct. The JDBC task doesn't change the names.
   But if you
 create the classes (om) it creates the column names with
   uppercase
 letters and than there is the problem because you
  cannot make any
 queries. Here is an example:

 Generated XML file (correct):

 table name=address
 column name=class javaName=aClass
  primaryKey=true
 required=true size=2 type=CHAR/
 column name=id primaryKey=true required=true
size=30
 type=VARCHAR/
 column name=position primaryKey=true
  required=true
 type=INTEGER/
 column name=name1 size=50 type=VARCHAR/
 column name=name2 size=50 type=VARCHAR/
 column name=name3 size=50 type=VARCHAR/
 column name=street size=50 type=VARCHAR/
 column name=zipcode size=25 type=VARCHAR/
 column name=city size=60 type=VARCHAR/
 column name=phone size=40 type=VARCHAR/
 column name=phone2 size=40 type=VARCHAR/
 column name=country size=200 type=VARCHAR/
 column name=state size=200 type=VARCHAR/
 column name=fax size=40 type=VARCHAR/
 column name=email size=150 type=VARCHAR/
 /table

 Generated constants in the BaseAddressPeer (incorrect):

 static
 {
   CLASS = address.CLASS;
   ID = address.ID;
   POSITION = address.POSITION;
   NAME1 = address.NAME1;
   NAME2 = address.NAME2;
   NAME3 = address.NAME3;
   STREET = address.STREET;
   ZIPCODE = address.ZIPCODE;
   CITY = address.CITY;
   PHONE = address.PHONE;
   PHONE2 = address.PHONE2;
   COUNTRY = address.COUNTRY;
   STATE = address.STATE;
   FAX = address.FAX;
   EMAIL = address.EMAIL;
 


 I think the uppercase column names or uppercase because
it's better to
 read (?). There is no bug in the Sybase JDBC driver (5.5
   and 6. 0).
 I've tested a generated SQL statement on the sybase console
 (isql) and it fails if the case is not correct, for example:

 SELECT  FROM address WHERE address.CITY=Hamburg

 failes, but with address.city=... everything is okay. I
think this
 case sensitive behaviour is a Sybase-feature... Maybe I
should ask
 someone on a Sybase JDBC mailinglist howto disable this
  behaviour.

 Bye
 Thoralf


  -Ursprüngliche Nachricht-
  Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
  Gesendet: Samstag, 15. Juli 2006 09:10
  An: Apache Torque Users List
  Betreff: Re: Sybase case insensitive column names
 
 
  Hi,
 
  This is strange; the jdbc task should preserve the case

AW: Columns are converted to uppercase

2006-07-19 Thread Thoralf Rickert
Hi,

there is currently a discussion about that problem on this list and a bug 
report ( http://issues.apache.org/jira/browse/TORQUE-44). If you need it now, 
you have to change the Torque templates that generates the column names in the 
Torque classes (Peer.vm and MapBuilder.vm). There is no switch or property for 
this problem.

bye
Thoralf

 -Ursprüngliche Nachricht-
 Von: Robert Kromkamp [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 19. Juli 2006 09:33
 An: Apache Torque Users List
 Betreff: Columns are converted to uppercase
 
 
 Hi All,
 
 By default, PostgreSQL folds names to lower case. So to 
 select * from Y there has to be a table named with a 
 lowercase 'y'. If the table name is really a capital 'Y' you 
 need: select * from Y
 
 At the moment while creating java files based on a Torque 
 schema, al columns are converted to uppercase. Is there an 
 option to converted the columns exactly as they are described 
 in the schema.xml (I've a mix of upper and lowercase like a 
 column PersonFirstname)? At the moment I am using Torque-3.1.1.
 
 Cheers,
 Robert
 
 -
 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]



AW: Sybase case insensitive column names

2006-07-17 Thread Thoralf Rickert
That is correct. The JDBC task doesn't change the names. But if you create the 
classes (om) it creates the column names with uppercase letters and than there 
is the problem because you cannot make any queries. Here is an example:

Generated XML file (correct):

table name=address
column name=class javaName=aClass primaryKey=true 
required=true size=2 type=CHAR/
column name=id primaryKey=true required=true size=30 
type=VARCHAR/
column name=position primaryKey=true required=true 
type=INTEGER/
column name=name1 size=50 type=VARCHAR/
column name=name2 size=50 type=VARCHAR/
column name=name3 size=50 type=VARCHAR/
column name=street size=50 type=VARCHAR/
column name=zipcode size=25 type=VARCHAR/
column name=city size=60 type=VARCHAR/
column name=phone size=40 type=VARCHAR/
column name=phone2 size=40 type=VARCHAR/
column name=country size=200 type=VARCHAR/
column name=state size=200 type=VARCHAR/
column name=fax size=40 type=VARCHAR/
column name=email size=150 type=VARCHAR/
/table

Generated constants in the BaseAddressPeer (incorrect):

static
{
  CLASS = address.CLASS;
  ID = address.ID;
  POSITION = address.POSITION;
  NAME1 = address.NAME1;
  NAME2 = address.NAME2;
  NAME3 = address.NAME3;
  STREET = address.STREET;
  ZIPCODE = address.ZIPCODE;
  CITY = address.CITY;
  PHONE = address.PHONE;
  PHONE2 = address.PHONE2;
  COUNTRY = address.COUNTRY;
  STATE = address.STATE;
  FAX = address.FAX;
  EMAIL = address.EMAIL;



I think the uppercase column names or uppercase because it's better to read 
(?). There is no bug in the Sybase JDBC driver (5.5 and 6.0). I've tested a 
generated SQL statement on the sybase console (isql) and it fails if the case 
is not correct, for example:

SELECT  FROM address WHERE address.CITY=Hamburg

failes, but with address.city=... everything is okay. I think this case 
sensitive behaviour is a Sybase-feature... Maybe I should ask someone on a 
Sybase JDBC mailinglist howto disable this behaviour.

Bye
Thoralf


 -Ursprüngliche Nachricht-
 Von: Thomas Fischer [mailto:[EMAIL PROTECTED] 
 Gesendet: Samstag, 15. Juli 2006 09:10
 An: Apache Torque Users List
 Betreff: Re: Sybase case insensitive column names
 
 
 Hi,
 
 This is strange; the jdbc task should preserve the case of 
 the table and 
 column names (I checked that using mysql; as I do not have a sybase 
 database). The jdbc task uses the DatabaseMetaData from the 
 jdbc driver to 
 get the database; if the database is case sensitive and the 
 DatabaseMetaData does not preserve case it is a bug of the 
 jdbc driver.
 
  Thomas
 
 On Thu, 13 Jul 2006, Thoralf Rickert wrote:
 
  Hi!
 
  I've created a schema.xml for an existing Sybase database and I was 
  able to generate the corresponding java classes. If I try to make a 
  query with them I run into a problem. The database uses 
 case sensitive 
  column names but torque generates uppercase column names. 
 For example 
  the following query throws an exception, because the column STATE 
  cannot be found (in the database it's called state).
 
   SELECT states.STATE FROM states ORDER BY states.STATE ASC
 
  Is there a way to handle this? Is there a sybase specific 
 connection 
  setting or something like that?
 
  Thanks
  Thoralf
 
 
  
 -
  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]
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Sybase case insensitive column names

2006-07-17 Thread Thoralf Rickert
Okay, I'll submit a bug report.

 -Ursprüngliche Nachricht-
 Von: Thomas Fischer [mailto:[EMAIL PROTECTED] 
 Gesendet: Montag, 17. Juli 2006 10:04
 An: Apache Torque Users List
 Betreff: AW: Sybase case insensitive column names
 
 
 The column names in the class files should be generated in 
 the same case as they appear in the schema file. If this is 
 not the case, this is a bug. This is Torque 3.2 and you did 
 not change anything there, I assume ? If yes, would you mind 
 to submit a bug report to Jira ?
 
Thomas
 
 Thoralf Rickert [EMAIL PROTECTED] schrieb am 17.07.2006
 09:19:17:
 
  That is correct. The JDBC task doesn't change the names. But if you 
  create the classes (om) it creates the column names with uppercase 
  letters and than there is the problem because you cannot make any 
  queries. Here is an example:
 
  Generated XML file (correct):
 
  table name=address
  column name=class javaName=aClass primaryKey=true 
  required=true size=2 type=CHAR/
  column name=id primaryKey=true required=true 
 size=30 
  type=VARCHAR/
  column name=position primaryKey=true required=true 
  type=INTEGER/
  column name=name1 size=50 type=VARCHAR/
  column name=name2 size=50 type=VARCHAR/
  column name=name3 size=50 type=VARCHAR/
  column name=street size=50 type=VARCHAR/
  column name=zipcode size=25 type=VARCHAR/
  column name=city size=60 type=VARCHAR/
  column name=phone size=40 type=VARCHAR/
  column name=phone2 size=40 type=VARCHAR/
  column name=country size=200 type=VARCHAR/
  column name=state size=200 type=VARCHAR/
  column name=fax size=40 type=VARCHAR/
  column name=email size=150 type=VARCHAR/
  /table
 
  Generated constants in the BaseAddressPeer (incorrect):
 
  static
  {
CLASS = address.CLASS;
ID = address.ID;
POSITION = address.POSITION;
NAME1 = address.NAME1;
NAME2 = address.NAME2;
NAME3 = address.NAME3;
STREET = address.STREET;
ZIPCODE = address.ZIPCODE;
CITY = address.CITY;
PHONE = address.PHONE;
PHONE2 = address.PHONE2;
COUNTRY = address.COUNTRY;
STATE = address.STATE;
FAX = address.FAX;
EMAIL = address.EMAIL;
  
 
 
  I think the uppercase column names or uppercase because 
 it's better to 
  read (?). There is no bug in the Sybase JDBC driver (5.5 and 6. 0). 
  I've tested a generated SQL statement on the sybase console
  (isql) and it fails if the case is not correct, for example:
 
  SELECT  FROM address WHERE address.CITY=Hamburg
 
  failes, but with address.city=... everything is okay. I 
 think this 
  case sensitive behaviour is a Sybase-feature... Maybe I 
 should ask 
  someone on a Sybase JDBC mailinglist howto disable this behaviour.
 
  Bye
  Thoralf
 
 
   -Ursprüngliche Nachricht-
   Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
   Gesendet: Samstag, 15. Juli 2006 09:10
   An: Apache Torque Users List
   Betreff: Re: Sybase case insensitive column names
  
  
   Hi,
  
   This is strange; the jdbc task should preserve the case 
 of the table 
   and column names (I checked that using mysql; as I do not have a 
   sybase database). The jdbc task uses the DatabaseMetaData from the
   jdbc driver to
   get the database; if the database is case sensitive and the
   DatabaseMetaData does not preserve case it is a bug of the
   jdbc driver.
  
Thomas
  
   On Thu, 13 Jul 2006, Thoralf Rickert wrote:
  
Hi!
   
I've created a schema.xml for an existing Sybase database and I 
was able to generate the corresponding java classes. If 
 I try to 
make a query with them I run into a problem. The database uses
   case sensitive
column names but torque generates uppercase column names.
   For example
the following query throws an exception, because the column 
STATE cannot be found (in the database it's called state).
   
 SELECT states.STATE FROM states ORDER BY states.STATE ASC
   
Is there a way to handle this? Is there a sybase specific
   connection
setting or something like that?
   
Thanks
Thoralf
   
   
   
   
 
   -
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]
  
  
 
 
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED

[jira] Commented: (TORQUE-39) Wrong database name in generated XML schema with jdbc task

2006-07-17 Thread Thoralf Rickert (JIRA)
[ 
http://issues.apache.org/jira/browse/TORQUE-39?page=comments#action_12421539 ] 

Thoralf Rickert commented on TORQUE-39:
---

Is it a big problem to hand over a property like torque.databaseName to the 
task or to parse the property torque.database.url?

 Wrong database name in generated XML schema with jdbc task
 --

 Key: TORQUE-39
 URL: http://issues.apache.org/jira/browse/TORQUE-39
 Project: Torque
  Issue Type: Bug
  Components: Generator
Affects Versions: 3.2
Reporter: Thoralf Rickert

 In org.apache.torque.task.TorqueJDBCTransformTask#generateXML() is a bug in 
 line 196.
 195:databaseNode = doc.createElement(database);
 196:databaseNode.setAttribute(name, dbUser);
 This would generate a wrong XML schema database name=dbUser instead of 
 database name=databaseName...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (TORQUE-44) Column names in generated classes are uppercase

2006-07-17 Thread Thoralf Rickert (JIRA)
Column names in generated classes are uppercase
---

 Key: TORQUE-44
 URL: http://issues.apache.org/jira/browse/TORQUE-44
 Project: Torque
  Issue Type: Bug
  Components: Generator
Reporter: Thoralf Rickert
 Attachments: patch.txt

The generator creates constants for the column names in tables. The content of 
this constants uses upper cases.

For example if you have a table like:

table name=address
column name=class javaName=aClass primaryKey=true 
required=true size=2 type=CHAR/
column name=id primaryKey=true required=true size=30 
type=VARCHAR/
column name=position primaryKey=true required=true 
type=INTEGER/
column name=name1 size=50 type=VARCHAR/
column name=name2 size=50 type=VARCHAR/
column name=name3 size=50 type=VARCHAR/
column name=street size=50 type=VARCHAR/
column name=zipcode size=25 type=VARCHAR/
column name=city size=60 type=VARCHAR/
column name=phone size=40 type=VARCHAR/
column name=phone2 size=40 type=VARCHAR/
column name=country size=200 type=VARCHAR/
column name=state size=200 type=VARCHAR/
column name=fax size=40 type=VARCHAR/
column name=email size=150 type=VARCHAR/
/table

The generator creates in the corresponding BaseAddressPeer the following 
constants.

...
static
{
  CLASS = address.CLASS;
  ID = address.ID;
  POSITION = address.POSITION;
  NAME1 = address.NAME1;
  NAME2 = address.NAME2;
  NAME3 = address.NAME3;
  STREET = address.STREET;
  ZIPCODE = address.ZIPCODE;
  CITY = address.CITY;
  PHONE = address.PHONE;
  PHONE2 = address.PHONE2;
  COUNTRY = address.COUNTRY;
  STATE = address.STATE;
  FAX = address.FAX;
  EMAIL = address.EMAIL;
   

but this variables should be for example address.email.
The AddressMapBuilder.doBuild() method creates the same uppercase mapping:

  public void doBuild() throws TorqueException {
...
dbMap.addTable(address);
TableMap tMap = dbMap.getTable(address);

tMap.setPrimaryKeyMethod(none);
tMap.addPrimaryKey(address.CLASS,  );
tMap.addPrimaryKey(address.ID,  );
tMap.addPrimaryKey(address.POSITION, new Integer(0) );
tMap.addColumn(address.NAME1, , 50 );
tMap.addColumn(address.NAME2, , 50 );
tMap.addColumn(address.NAME3, , 50 );
tMap.addColumn(address.STREET, , 50 );
tMap.addColumn(address.ZIPCODE, , 25 );
tMap.addColumn(address.CITY, , 60 );
tMap.addColumn(address.PHONE, , 40 );
tMap.addColumn(address.PHONE2, , 40 );
tMap.addColumn(address.COUNTRY, , 200 );
tMap.addColumn(address.STATE, , 200 );
tMap.addColumn(address.FAX, , 40 );
tMap.addColumn(address.EMAIL, , 150 );
}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (TORQUE-44) Column names in generated classes are uppercase

2006-07-17 Thread Thoralf Rickert (JIRA)
 [ http://issues.apache.org/jira/browse/TORQUE-44?page=all ]

Thoralf Rickert updated TORQUE-44:
--

Attachment: patch.txt

The problem is that the generator uses the variable 
$cup=$col.Name.toUpperCase() for the name of the constant and for the content 
of it. The patch changes the Peer and the MapBuilder template. Hope it works.

 Column names in generated classes are uppercase
 ---

 Key: TORQUE-44
 URL: http://issues.apache.org/jira/browse/TORQUE-44
 Project: Torque
  Issue Type: Bug
  Components: Generator
Reporter: Thoralf Rickert
 Attachments: patch.txt


 The generator creates constants for the column names in tables. The content 
 of this constants uses upper cases.
 For example if you have a table like:
 table name=address
 column name=class javaName=aClass primaryKey=true 
 required=true size=2 type=CHAR/
 column name=id primaryKey=true required=true size=30 
 type=VARCHAR/
 column name=position primaryKey=true required=true 
 type=INTEGER/
 column name=name1 size=50 type=VARCHAR/
 column name=name2 size=50 type=VARCHAR/
 column name=name3 size=50 type=VARCHAR/
 column name=street size=50 type=VARCHAR/
 column name=zipcode size=25 type=VARCHAR/
 column name=city size=60 type=VARCHAR/
 column name=phone size=40 type=VARCHAR/
 column name=phone2 size=40 type=VARCHAR/
 column name=country size=200 type=VARCHAR/
 column name=state size=200 type=VARCHAR/
 column name=fax size=40 type=VARCHAR/
 column name=email size=150 type=VARCHAR/
 /table
 The generator creates in the corresponding BaseAddressPeer the following 
 constants.
 ...
 static
 {
   CLASS = address.CLASS;
   ID = address.ID;
   POSITION = address.POSITION;
   NAME1 = address.NAME1;
   NAME2 = address.NAME2;
   NAME3 = address.NAME3;
   STREET = address.STREET;
   ZIPCODE = address.ZIPCODE;
   CITY = address.CITY;
   PHONE = address.PHONE;
   PHONE2 = address.PHONE2;
   COUNTRY = address.COUNTRY;
   STATE = address.STATE;
   FAX = address.FAX;
   EMAIL = address.EMAIL;

 but this variables should be for example address.email.
 The AddressMapBuilder.doBuild() method creates the same uppercase mapping:
   public void doBuild() throws TorqueException {
 ...
 dbMap.addTable(address);
 TableMap tMap = dbMap.getTable(address);
 tMap.setPrimaryKeyMethod(none);
 tMap.addPrimaryKey(address.CLASS,  );
 tMap.addPrimaryKey(address.ID,  );
 tMap.addPrimaryKey(address.POSITION, new Integer(0) );
 tMap.addColumn(address.NAME1, , 50 );
 tMap.addColumn(address.NAME2, , 50 );
 tMap.addColumn(address.NAME3, , 50 );
 tMap.addColumn(address.STREET, , 50 );
 tMap.addColumn(address.ZIPCODE, , 25 );
 tMap.addColumn(address.CITY, , 60 );
 tMap.addColumn(address.PHONE, , 40 );
 tMap.addColumn(address.PHONE2, , 40 );
 tMap.addColumn(address.COUNTRY, , 200 );
 tMap.addColumn(address.STATE, , 200 );
 tMap.addColumn(address.FAX, , 40 );
 tMap.addColumn(address.EMAIL, , 150 );
 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Commented: (TORQUE-45) Generated SQL is in wrong order when dropping tables on table re-creation

2006-07-17 Thread Thoralf Rickert (JIRA)
[ 
http://issues.apache.org/jira/browse/TORQUE-45?page=comments#action_12421580 ] 

Thoralf Rickert commented on TORQUE-45:
---

 So how are tables with circular references dropped? 

I have this circular references problem in one of my schemes. And my solution 
is to drop the whole database. 

This isn't a problem in a development environment (it's faster) and later in a 
production environment you don't drop tables.


 Generated SQL is in wrong order when dropping tables on table re-creation
 -

 Key: TORQUE-45
 URL: http://issues.apache.org/jira/browse/TORQUE-45
 Project: Torque
  Issue Type: Bug
  Components: Generator
Affects Versions: 3.2, 3.1.1
 Environment: java 1.4.2, 1.5. Solaris 10.
Reporter: Joe Carter

 When the table creation SQL is re-run when the schema contains foreign keys, 
 you will get referential integrity complaints.
 This is because the table drop order means that it tries to drop dependent 
 tables first.
 To fix this, the drop statements should be before all the creates. They 
 should also be in reverse order to the creates.
 A method to be able to obtain the tables in reverse order will be needed to 
 allow the templates to be modified to fix this.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Sybase case insensitive column names

2006-07-13 Thread Thoralf Rickert
Hi!

I've created a schema.xml for an existing Sybase database and I was able
to generate the corresponding java classes. If I try to make a query
with them I run into a problem. The database uses case sensitive column
names but torque generates uppercase column names. For example the
following query throws an exception, because the column STATE cannot
be found (in the database it's called state).

  SELECT states.STATE FROM states ORDER BY states.STATE ASC

Is there a way to handle this? Is there a sybase specific connection
setting or something like that?

Thanks
Thoralf


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: AW: Problem with SQL Task jdbc

2006-07-12 Thread Thoralf Rickert
Hi!

I tried the database user and DBO. That doesn't work but dbo works. I'll 
update the issue.

Thanks

Thoralf


 -Ursprüngliche Nachricht-
 Von: Andras Balogh [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 11. Juli 2006 16:48
 An: Apache Torque Users List
 Betreff: Re: AW: Problem with SQL Task jdbc
 
 
 Hello,
 
 Do not set  torque.database.schema to null.
 Try to set it to the name of the user who connects to the DB 
 or to value 
 DBO (or dbo)
 I had to add  to SQL server so it might work for Sybase also.
 
 Best regards,
 Andras.
 
 Thoralf Rickert wrote:
 
 Okay, the property torque.database.schema has to be null - otherwise 
 the driver returns an empty list of tables. But I cannot set 
 it to null 
 (comment out torque.database.schema results in a String with the 
 content ${torque.database.schema}).
 
 I think this is a bug too - maybe sybase specific (it works with 
 mysql).
 
 bye
 Thoralf
   
 
 
 
 -
 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]



[jira] Commented: (TORQUE-40) jdbc task fails on sybase database (schema is set)

2006-07-12 Thread Thoralf Rickert (JIRA)
[ 
http://issues.apache.org/jira/browse/TORQUE-40?page=comments#action_12420568 ] 

Thoralf Rickert commented on TORQUE-40:
---

You have to set

torque.database.schema = dbo

in the properties to avoid this problem. 
Thanks to Andras Balogh.

I think, this bug is fixed.

 jdbc task fails on sybase database (schema is set)
 --

  Key: TORQUE-40
  URL: http://issues.apache.org/jira/browse/TORQUE-40
  Project: Torque
 Type: Bug

   Components: Generator
 Versions: 3.2.1
  Environment: Sybase ASE 12.5
 jConnect for JDBC 2.0 v5.5 Build 25137 or v6.05 Build 25828
 Java Tds Server Classes v5.5 Build 25138 or v6.0 Build 25828
 Reporter: Thoralf Rickert


 The Sybase JDBC driver doesn't expect a parameter for databaseSchema in
 DatabaseMetaData.getTables(String catalog, String schemaPattern, String 
 tableNamePattern, String[] types)
 DatabaseMetaData.getColumns(String catalog, String schemaPattern, String 
 tableNamePattern, String columnNamePattern)
 DatabaseMetaData.getPrimaryKeys(String catalog, String schema, String table)
 DatabaseMetaData.getImportedKeys(String catalog, String schema, String table)
 If it is set to something else than null the methods return nothing. So 
 please add the following fix (pseudo code):
 public void execute() throws BuildException
 {
   
   if (config(torque.database.type).equals(sybase)) 
   {
 dbSchema = null;
   }
   ...
 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Resolved: (TORQUE-40) jdbc task fails on sybase database (schema is set)

2006-07-12 Thread Thoralf Rickert (JIRA)
 [ http://issues.apache.org/jira/browse/TORQUE-40?page=all ]
 
Thoralf Rickert resolved TORQUE-40:
---

Resolution: Won't Fix

See my previous comment. torque.database.schema  must be set to dbo.

 jdbc task fails on sybase database (schema is set)
 --

  Key: TORQUE-40
  URL: http://issues.apache.org/jira/browse/TORQUE-40
  Project: Torque
 Type: Bug

   Components: Generator
 Versions: 3.2.1
  Environment: Sybase ASE 12.5
 jConnect for JDBC 2.0 v5.5 Build 25137 or v6.05 Build 25828
 Java Tds Server Classes v5.5 Build 25138 or v6.0 Build 25828
 Reporter: Thoralf Rickert


 The Sybase JDBC driver doesn't expect a parameter for databaseSchema in
 DatabaseMetaData.getTables(String catalog, String schemaPattern, String 
 tableNamePattern, String[] types)
 DatabaseMetaData.getColumns(String catalog, String schemaPattern, String 
 tableNamePattern, String columnNamePattern)
 DatabaseMetaData.getPrimaryKeys(String catalog, String schema, String table)
 DatabaseMetaData.getImportedKeys(String catalog, String schema, String table)
 If it is set to something else than null the methods return nothing. So 
 please add the following fix (pseudo code):
 public void execute() throws BuildException
 {
   
   if (config(torque.database.type).equals(sybase)) 
   {
 dbSchema = null;
   }
   ...
 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Commented: (TORQUE-27) Need ability to pass global user-configurable platform-specific hints to templates

2006-07-12 Thread Thoralf Rickert (JIRA)
[ 
http://issues.apache.org/jira/browse/TORQUE-27?page=comments#action_12420575 ] 

Thoralf Rickert commented on TORQUE-27:
---

The proposal to create application specific custom templates isn't flexible. If 
you upgrade torque, you've to upgrade and change your templates again. When you 
don't do this once a year - you've forgotten, what you did with the templates. 
If you use a script to change the generated code, you've to change this script 
too. I think one of the main goals of torque should be to have static templates 
that the user doesn't have to change.

The table type hint in this bug relates to the used storage engine in the 
database tables. I think mysql isn't the only database that supports more than 
one storage engine (this will be a key feature of future databases). So this 
should be an optional table specific property with a default value for the 
database. Of course, I'm using INNODB too and I'm using application specific 
templates because of that.

On the other hand it would be useful to have such hints to add database, table 
or column specific hints or features to the database schema (for example 
charset encoding, mime-types, auto-increment start values, unsigned values and 
so on). I think this could be in the template properties in the torque 
properties but this seems to be unusual - especially if you have to set column 
hints. It looks for me as a quick hack.

I think it would be better to add a new attribute to the xml tags database, 
table and column (maybe other too). The value of this attribute can be 
added to the generated sql output (just a plain pass thru without parsing).

 Need ability to pass global user-configurable platform-specific hints to 
 templates
 --

  Key: TORQUE-27
  URL: http://issues.apache.org/jira/browse/TORQUE-27
  Project: Torque
 Type: Improvement

   Components: Generator
 Versions: 3.2
  Environment: Fedora Core 5 Linux, Sun JDK1.4.2_08.
 Reporter: Adrian Price
 Priority: Minor


 It would be useful to provide a generic mechanism to enable the user to pass 
 global platform-specific hints to templates. For example, for MySQL it is 
 desirable to explicitly specify the type of table to be created, e.g., CREATE 
 TABLE foo (...) Type = InnoDB. Such global hints could then be specified by 
 the user through platform specific properties or property files, as in: 
 platform.properties:
 mysql.table.hint=Type = InnoDB. 
 A matching table.vm template might look something like:
 # ---
 # $table.Name
 # ---
 $generator.parse($basepath/drop.vm, , table, $tbl)
 CREATE TABLE $table.Name
 (
 etc...
 ) $platform.getProperty('mysql.table.hint');
 Without such a capability it is necessary to hard-code the required 
 customizations into the templates, which is a rather inflexible and 
 inconvenient way of doing it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (TORQUE-43) retrieveByPK uses name instead of javaName

2006-07-12 Thread Thoralf Rickert (JIRA)
retrieveByPK uses name instead of javaName
--

 Key: TORQUE-43
 URL: http://issues.apache.org/jira/browse/TORQUE-43
 Project: Torque
Type: Bug

  Components: Generator  
Versions: 3.2.1
Reporter: Thoralf Rickert
Priority: Minor


If you have a column definition like:

column name=class javaName=aClass primaryKey=true required=true 
size=30 type=VARCHAR/

the generator creates retrieveByPK method with a parameter called class 
instead of aClass. This is unexpected.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (TORQUE-43) retrieveByPK uses name instead of javaName

2006-07-12 Thread Thoralf Rickert (JIRA)
 [ http://issues.apache.org/jira/browse/TORQUE-43?page=all ]

Thoralf Rickert updated TORQUE-43:
--

Attachment: patch.txt

This is a patch for this bug in Peer.vm

 retrieveByPK uses name instead of javaName
 --

  Key: TORQUE-43
  URL: http://issues.apache.org/jira/browse/TORQUE-43
  Project: Torque
 Type: Bug

   Components: Generator
 Versions: 3.2.1
 Reporter: Thoralf Rickert
 Priority: Minor
  Attachments: patch.txt

 If you have a column definition like:
 column name=class javaName=aClass primaryKey=true required=true 
 size=30 type=VARCHAR/
 the generator creates retrieveByPK method with a parameter called class 
 instead of aClass. This is unexpected.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem with SQL Task jdbc

2006-07-11 Thread Thoralf Rickert
Hi!

I try to generate a XML schema for a Sybase database. The problem is
that the task runs without an error but the generated schema.xml is
empty. I think, I forgot a property but I don't know which one. Here are
my torque properties and the generated output:

#
torque.database.type= sybase
torque.database.user= sa
torque.database.password= password
torque.database.driver  =
com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
torque.database.url = jdbc:sybase:Tds:dbtest:2510/cadooz
torque.database.validationQuery = SELECT 1

#
torque.database.default = intershop
torque.database.schema  = intershop
torque.database.intershop.adapter   = sybase
torque.dsfactory.intershop.factory  =
  org.apache.torque.dsfactory.SharedPoolDataSourceFactory
torque.dsfactory.intershop.pool.maxIdle = 8
torque.dsfactory.intershop.pool.maxActive   = 10
torque.dsfactory.intershop.pool.maxWait = 1
torque.dsfactory.intershop.pool.timeBetweenEvictionRunsMillis = 30
torque.dsfactory.intershop.pool.minEvictableIdleTimeMillis = 360
torque.dsfactory.intershop.pool.testOnBorrow= true
torque.dsfactory.intershop.pool.validationQuery = SELECT 1
torque.dsfactory.intershop.connection.driver=
com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
torque.dsfactory.intershop.connection.url   =
jdbc:sybase:Tds:dbtest:2510/cadooz
torque.dsfactory.intershop.connection.user  = sa
torque.dsfactory.intershop.connection.password  = password
torque.manager.useCache = true

#
torque.home= .
torque.project = intershop
torque.database= sybase
torque.targetPackage   =
com.cadooz.framework.intershop.database
torque.subpackage.map  = map
torque.subpackage.manager  = manager
torque.runOnlyOnSchemaChange   = false
torque.output.dir  = .
torque.schema.dir  =
${torque.home}/resources/schema/intershop
torque.templatePath=
${torque.home}/resources/torque
torque.doc.dir = ${torque.home}/doc
torque.java.dir= ${torque.home}/src
torque.ojb.dir =
${torque.home}/resources/torque
torque.sql.dir =
${torque.home}/resources/schema/intershop
torque.database.createUrl  =
jdbc:sybase:Tds:dbtest:2510/cadooz
torque.database.buildUrl   =
jdbc:sybase:Tds:dbtest:2510/cadooz
torque.database.url=
jdbc:sybase:Tds:dbtest:2510/cadooz
torque.database.host   = dbtest
torque.useManagers = false


The console output is (I'm using ant)

jdbc:
 [echo] +---+
 [echo] |   |
 [echo] | Generating XML from JDBC connection ! |
 [echo] |   |
 [echo] +---+
[torque-jdbc-transform] Torque - JDBCToXMLSchema starting
[torque-jdbc-transform] Your DB settings are:
[torque-jdbc-transform] driver :
com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
[torque-jdbc-transform] URL :
jdbc:sybase:Tds:dbtest.cadooz-ag.intern:2510/cadooz
[torque-jdbc-transform] user : sa
[torque-jdbc-transform] schema : intershop
[torque-jdbc-transform] DB driver sucessfuly instantiated
[torque-jdbc-transform] DB connection established
[torque-jdbc-transform] Getting table list...
[torque-jdbc-transform] Building column/table map...
[torque-jdbc-transform] ./resources/schema/intershop/schema.xml
[torque-jdbc-transform] Torque - JDBCToXMLSchema finished
 [echo] ...done.
BUILD SUCCESSFUL
Total time: 7 seconds

This generates a XML file with the following content.

?xml version=1.0?
!DOCTYPE database SYSTEM
http://db.apache.org/torque/dtd/database_3_2.dtd;
!-- Autogenerated by JDBCToXMLSchema! --
database name=sa/


Of course, there are more than 0 tables in this database. 

It's strange, that it sets the database name to the database user name
sa. In org.apache.torque.task.TorqueJDBCTransformTask#generateXML
line 196 is a bug:

195:databaseNode = doc.createElement(database);
196:databaseNode.setAttribute(name, dbUser);

I think this should be something like:
196:databaseNode.setAttribute(name, dbName);
Where dbName is the name of the database (I'll make a bug report). But
that doesn't solve my problem.

bye
Thoralf


-
To unsubscribe, e-mail: [EMAIL PROTECTED]

AW: Problem with SQL Task jdbc

2006-07-11 Thread Thoralf Rickert
Okay, the property torque.database.schema has to be null - otherwise the driver 
returns an empty list of tables. But I cannot set it to null (comment out 
torque.database.schema results in a String with the content 
${torque.database.schema}).

I think this is a bug too - maybe sybase specific (it works with mysql).

bye
Thoralf

 -Ursprüngliche Nachricht-
 Von: Thoralf Rickert [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 11. Juli 2006 15:42
 An: Apache Torque Users List
 Betreff: Problem with SQL Task jdbc
 
 
 Hi!
 
 I try to generate a XML schema for a Sybase database. The 
 problem is that the task runs without an error but the 
 generated schema.xml is empty. I think, I forgot a property 
 but I don't know which one. Here are my torque properties and 
 the generated output:
 
 #
 torque.database.type= sybase
 torque.database.user= sa
 torque.database.password= password
 torque.database.driver  =
 com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
 torque.database.url = jdbc:sybase:Tds:dbtest:2510/cadooz
 torque.database.validationQuery = SELECT 1
 
 #
 torque.database.default = intershop
 torque.database.schema  = intershop
 torque.database.intershop.adapter   = sybase
 torque.dsfactory.intershop.factory  =
   org.apache.torque.dsfactory.SharedPoolDataSourceFactory
 torque.dsfactory.intershop.pool.maxIdle = 8
 torque.dsfactory.intershop.pool.maxActive   = 10
 torque.dsfactory.intershop.pool.maxWait = 1
 torque.dsfactory.intershop.pool.timeBetweenEvictionRunsMillis 
 = 30 
 torque.dsfactory.intershop.pool.minEvictableIdleTimeMillis = 360
 torque.dsfactory.intershop.pool.testOnBorrow= true
 torque.dsfactory.intershop.pool.validationQuery = SELECT 1
 torque.dsfactory.intershop.connection.driver=
 com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
 torque.dsfactory.intershop.connection.url   =
 jdbc:sybase:Tds:dbtest:2510/cadooz
 torque.dsfactory.intershop.connection.user  = sa
 torque.dsfactory.intershop.connection.password  = password
 torque.manager.useCache = true
 
 #
 torque.home= .
 torque.project = intershop
 torque.database= sybase
 torque.targetPackage   =
 com.cadooz.framework.intershop.database
 torque.subpackage.map  = map
 torque.subpackage.manager  = manager
 torque.runOnlyOnSchemaChange   = false
 torque.output.dir  = .
 torque.schema.dir  =
 ${torque.home}/resources/schema/intershop
 torque.templatePath=
 ${torque.home}/resources/torque
 torque.doc.dir = 
 ${torque.home}/doc
 torque.java.dir= 
 ${torque.home}/src
 torque.ojb.dir =
 ${torque.home}/resources/torque
 torque.sql.dir =
 ${torque.home}/resources/schema/intershop
 torque.database.createUrl  =
 jdbc:sybase:Tds:dbtest:2510/cadooz
 torque.database.buildUrl   =
 jdbc:sybase:Tds:dbtest:2510/cadooz
 torque.database.url=
 jdbc:sybase:Tds:dbtest:2510/cadooz
 torque.database.host   = dbtest
 torque.useManagers = false
 
 
 The console output is (I'm using ant)
 
 jdbc:
  [echo] +---+
  [echo] |   |
  [echo] | Generating XML from JDBC connection ! |
  [echo] |   |
  [echo] +---+
 [torque-jdbc-transform] Torque - JDBCToXMLSchema starting 
 [torque-jdbc-transform] Your DB settings are: 
 [torque-jdbc-transform] driver : 
 com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
 [torque-jdbc-transform] URL : 
 jdbc:sybase:Tds:dbtest.cadooz-ag.intern:2510/cadooz
 [torque-jdbc-transform] user : sa
 [torque-jdbc-transform] schema : intershop 
 [torque-jdbc-transform] DB driver sucessfuly instantiated 
 [torque-jdbc-transform] DB connection established 
 [torque-jdbc-transform] Getting table list... 
 [torque-jdbc-transform] Building column/table map... 
 [torque-jdbc-transform] ./resources/schema/intershop/schema.xml
 [torque-jdbc-transform] Torque - JDBCToXMLSchema finished
  [echo] ...done.
 BUILD SUCCESSFUL
 Total time: 7 seconds
 
 This generates a XML file with the following content.
 
 ?xml version=1.0?
 !DOCTYPE database SYSTEM 
 http://db.apache.org/torque/dtd/database_3_2.dtd;
 !-- Autogenerated by JDBCToXMLSchema! --
 database name=sa/
 
 
 Of course

[jira] Created: (TORQUE-38) Wrong Default Setting for torque.enableJava5Features on website

2006-07-11 Thread Thoralf Rickert (JIRA)
Wrong Default Setting for torque.enableJava5Features on website
---

 Key: TORQUE-38
 URL: http://issues.apache.org/jira/browse/TORQUE-38
 Project: Torque
Type: Bug

  Components: Documentation  
Reporter: Thoralf Rickert
Priority: Trivial


On the site 
http://db.apache.org/torque/releases/torque-3.2/generator/properties-reference.html
 is a bug in the documentation for the torque.enableJava5Features property. The 
default should been false and not Bean.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (TORQUE-38) Wrong Default Setting for torque.enableJava5Features on website

2006-07-11 Thread Thoralf Rickert (JIRA)
 [ http://issues.apache.org/jira/browse/TORQUE-38?page=all ]

Thoralf Rickert updated TORQUE-38:
--

Description: On the site 
http://db.apache.org/torque/releases/torque-3.2/generator/properties-reference.html
 is a bug in the documentation for the torque.enableJava5Features property. The 
default should be false and not Bean.  (was: On the site 
http://db.apache.org/torque/releases/torque-3.2/generator/properties-reference.html
 is a bug in the documentation for the torque.enableJava5Features property. The 
default should been false and not Bean.)

 Wrong Default Setting for torque.enableJava5Features on website
 ---

  Key: TORQUE-38
  URL: http://issues.apache.org/jira/browse/TORQUE-38
  Project: Torque
 Type: Bug

   Components: Documentation
 Reporter: Thoralf Rickert
 Priority: Trivial


 On the site 
 http://db.apache.org/torque/releases/torque-3.2/generator/properties-reference.html
  is a bug in the documentation for the torque.enableJava5Features property. 
 The default should be false and not Bean.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Velocity Templates

2006-07-10 Thread Thoralf Rickert
Hi!

I think there is an open discussion thread (in 2005) about the generated
code style in the Base* classes but I can't find it. The problem is
that the generated code looks a little bit ugly because of too many
spaces. This is a velocity problem, because of leading spaces in front
of velocity commands like #if and #end.

We've the same problem in one of our projects where we use velocity
templates to render XHTML pages. There I made a small patch in our
VelocityTemplateLoader to generate better code. 

Here is an example of a template:
 public void helloWorld()
 {
   #if($useLog)
 log.debug(Hello World called);
   #else
 System.out.println(Hello World called);
   #end
 }

These leading spaces makes the code unattractive and sometimes
unreadable. The patch is to remove any leading spaces in front of any
velocity command. It's a line-by-line replacement regex with ^\s# to
#. The result that is send to the renderer looks like this.

 public void helloWorld()
 {
#if($useLog)
 log.debug(Hello World called);
#else
 System.out.println(Hello World called);
#end
 }


The solution is simple but doesn't fix every problem. Of course this
could generate other problems. For example the following code compiles
well without the patch.

But with the patch it creates a velocity compile error, because of
missing output between #if and #else

 public void helloWorld()
 {
   #if($useLog)
   #else
 System.out.println(Hello World called);
   #end
 }

If you're interested in such a patch I would make it for the
torque-generator.

bye
Thoralf


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Velocity Templates

2006-07-10 Thread Thoralf Rickert
No, I don't want to change the templates. They will be changed virtually during 
loading into the velocity renderer in a stream.


 -Ursprüngliche Nachricht-
 Von: Thomas Fischer [mailto:[EMAIL PROTECTED] 
 Gesendet: Montag, 10. Juli 2006 10:17
 An: Apache Torque Developers List
 Betreff: Re: Velocity Templates
 
 
 Hi,
 
 The spaces in front of the velocity commands exist because it 
 makes the templates themselves readable. I'd put more 
 emphasis on keeping the templates readable than the generated 
 code, so I'd rather leave the spaces where they are.
 
  Thomas
 
 Thoralf Rickert [EMAIL PROTECTED] schrieb am 10.07.2006
 09:43:18:
 
  Hi!
 
  I think there is an open discussion thread (in 2005) about the 
  generated code style in the Base* classes but I can't find it. The 
  problem is that the generated code looks a little bit 
 ugly because 
  of too many spaces. This is a velocity problem, because of leading 
  spaces in front of velocity commands like #if and #end.
 
  We've the same problem in one of our projects where we use velocity 
  templates to render XHTML pages. There I made a small patch in our 
  VelocityTemplateLoader to generate better code.
 
  Here is an example of a template:
   public void helloWorld()
   {
 #if($useLog)
   log.debug(Hello World called);
 #else
   System.out.println(Hello World called);
 #end
   }
 
  These leading spaces makes the code unattractive and sometimes 
  unreadable. The patch is to remove any leading spaces in 
 front of any 
  velocity command. It's a line-by-line replacement regex 
 with ^\s# to 
  #. The result that is send to the renderer looks like this.
 
   public void helloWorld()
   {
  #if($useLog)
   log.debug(Hello World called);
  #else
   System.out.println(Hello World called);
  #end
   }
 
 
  The solution is simple but doesn't fix every problem. Of 
 course this 
  could generate other problems. For example the following 
 code compiles 
  well without the patch.
 
  But with the patch it creates a velocity compile error, because of 
  missing output between #if and #else
 
   public void helloWorld()
   {
 #if($useLog)
 #else
   System.out.println(Hello World called);
 #end
   }
 
  If you're interested in such a patch I would make it for the 
  torque-generator.
 
  bye
  Thoralf
 
 
  
 -
  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]
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Velocity Templates

2006-07-10 Thread Thoralf Rickert
 Sorry, I did not read that out of your message. 

Yes, you'are right - the on-the-fly info is important but not mentioned.

 This would be 
 a good feature in my opinion. Regarding the nothing between 
 #if and #else problem: a line break is not enough ?

If there is something like this:

  public void helloWorld()
  {
#if($useLog)

#else
  System.out.println(Hello World called);
#end
  }

Then it isn't a problem. But without the empty line - it breaks. But I think, 
it's easy to test. I think, your test-cases should show every problem and it's 
very easy to revert to a working system (just uncomment one line of code).


 
Thomas
 
 Thoralf Rickert [EMAIL PROTECTED] schrieb am 10.07.2006
 11:59:43:
 
  No, I don't want to change the templates. They will be changed 
  virtually during loading into the velocity renderer in a stream.
 
 
   -Ursprüngliche Nachricht-
   Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
   Gesendet: Montag, 10. Juli 2006 10:17
   An: Apache Torque Developers List
   Betreff: Re: Velocity Templates
  
  
   Hi,
  
   The spaces in front of the velocity commands exist 
 because it makes 
   the templates themselves readable. I'd put more emphasis 
 on keeping 
   the templates readable than the generated code, so I'd 
 rather leave 
   the spaces where they are.
  
Thomas
  
   Thoralf Rickert [EMAIL PROTECTED] schrieb am 
 10.07.2006
   09:43:18:
  
Hi!
   
I think there is an open discussion thread (in 2005) about the 
generated code style in the Base* classes but I can't 
 find it. The 
problem is that the generated code looks a little bit
   ugly because
of too many spaces. This is a velocity problem, because 
 of leading 
spaces in front of velocity commands like #if and #end.
   
We've the same problem in one of our projects where we use 
velocity templates to render XHTML pages. There I made a small 
patch in our VelocityTemplateLoader to generate better code.
   
Here is an example of a template:
 public void helloWorld()
 {
   #if($useLog)
 log.debug(Hello World called);
   #else
 System.out.println(Hello World called);
   #end
 }
   
These leading spaces makes the code unattractive and 
 sometimes 
unreadable. The patch is to remove any leading spaces in
   front of any
velocity command. It's a line-by-line replacement regex
   with ^\s# to
#. The result that is send to the renderer looks like this.
   
 public void helloWorld()
 {
#if($useLog)
 log.debug(Hello World called);
#else
 System.out.println(Hello World called);
#end
 }
   
   
The solution is simple but doesn't fix every problem. Of
   course this
could generate other problems. For example the following
   code compiles
well without the patch.
   
But with the patch it creates a velocity compile error, 
 because of 
missing output between #if and #else
   
 public void helloWorld()
 {
   #if($useLog)
   #else
 System.out.println(Hello World called);
   #end
 }
   
If you're interested in such a patch I would make it for the 
torque-generator.
   
bye
Thoralf
   
   
   
   
 
   -
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]
  
  
 
 
  
 -
  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]
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (TORQUE-31) complete generic type compatible API

2006-06-22 Thread Thoralf Rickert (JIRA)
 [ http://issues.apache.org/jira/browse/TORQUE-31?page=all ]

Thoralf Rickert updated TORQUE-31:
--

Attachment: TORQUE-31.patch

Okay, this are the changes for the Peer.vm to be a little bit more generic type 
compatible.

 complete generic type compatible API
 

  Key: TORQUE-31
  URL: http://issues.apache.org/jira/browse/TORQUE-31
  Project: Torque
 Type: Improvement

   Components: Generator
 Versions: 3.2.1
 Reporter: Thoralf Rickert
 Priority: Trivial
  Attachments: TORQUE-31.patch

 If the generator creates Java5 compatible methods then there are some methods 
 from BasePeer that are not wrapped. This includes for example the execute*() 
 methods. If we wrap them in the generated classes the API looks a little bit 
 better. 
 Currently there is just one easy solution in my mind - wrap this methods in 
 the generated Base classes. For example:
 public class BaseTablePeer extends BasePeer {
   
   public static ListRecord executeQuery(String queryString) throws 
 TorqueException {
 return (ListRecord)super.executeQuery(queryString);
   }
   
 }
 This means, that every public method in BasePeer should be wrapped in the 
 generated class. I know, this is a lot and results in bigger classes and some 
 synchronization problems, if the API of BasePeer is changed. But I think, 
 it's easy to create.
 I'll create a patch for that next week.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (TORQUE-31) complete generic type compatible API

2006-06-18 Thread Thoralf Rickert (JIRA)
complete generic type compatible API


 Key: TORQUE-31
 URL: http://issues.apache.org/jira/browse/TORQUE-31
 Project: Torque
Type: Improvement

  Components: Generator  
Versions: 3.2.1
Reporter: Thoralf Rickert
Priority: Trivial


If the generator creates Java5 compatible methods then there are some methods 
from BasePeer that are not wrapped. This includes for example the execute*() 
methods. If we wrap them in the generated classes the API looks a little bit 
better. 

Currently there is just one easy solution in my mind - wrap this methods in the 
generated Base classes. For example:

public class BaseTablePeer extends BasePeer {
  
  public static ListRecord executeQuery(String queryString) throws 
TorqueException {
return (ListRecord)super.executeQuery(queryString);
  }
  
}

This means, that every public method in BasePeer should be wrapped in the 
generated class. I know, this is a lot and results in bigger classes and some 
synchronization problems, if the API of BasePeer is changed. But I think, it's 
easy to create.

I'll create a patch for that next week.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: [jira] Resolved: (TORQUE-23) DeepCopy

2006-06-01 Thread Thoralf Rickert
Thanks!


 -Ursprüngliche Nachricht-
 Von: Thomas Fischer (JIRA) [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 31. Mai 2006 23:19
 An: torque-dev@db.apache.org
 Betreff: [jira] Resolved: (TORQUE-23) DeepCopy
 
 
  [ http://issues.apache.org/jira/browse/TORQUE-23?page=all ]
  
 Thomas Fischer resolved TORQUE-23:
 --
 
 Fix Version: 3.2.1
  Resolution: Fixed
   Assign To: Thomas Fischer
 
 Fixed in SVN.
 Changed the attached patch in order to retain the old 
 behaviour if complexObjectModel is false. Added the missing 
 parameter in call of copyInto()  in method copy(boolean)
 
 
  DeepCopy
  
 
   Key: TORQUE-23
   URL: http://issues.apache.org/jira/browse/TORQUE-23
   Project: Torque
  Type: New Feature
 
Components: Generator
  Reporter: Thoralf Rickert
  Assignee: Thomas Fischer
  Priority: Minor
   Fix For: 3.2.1
   Attachments: patch.txt
 
  I've a small problem with the copy() and copyInto() methods in the 
  generated Torque objects. I've tables with dependencies from other 
  tables (for example a table login which has a foreign key 
 to a table 
  address). I want to use the BaseAddress.copy() method to 
 copy the address object and save it. If I use this method, it 
 also loads and copies internally all logins which are linked 
 to the source address to the new address. So, it makes a deep 
 copy. If the object Address has many hundreds related 
 objects of Login this deep copy makes a lot that is 
 sometimes not necessary. So, it's better to let the 
 user/programmer decide if there program should do a deep copy 
 or not. The best way would be, that there is a copy(boolean) 
 method that should be added during BaseAddress generation. I 
 think, it's not very complicated to add this feature. Here 
 is my proposal: 1. add in Object.vm a new boolean parameter 
 to copy() like this
  public $table.JavaName copy(boolean deepcopy) throws 
 TorqueException
  {
  return copyInto(new ${table.JavaName}(),deepcopy);
  }
  2. create two new downwards compatible methods copy() and copyInto()
  public $table.JavaName copy() throws TorqueException
  {
  return copy(true);
  }
  protected $table.JavaName copyInto($table.JavaName 
 copyObj) throws TorqueException
  {
  return copyInto(copyObject, true);
  }
  3. add a new parameter deepcopy to the old copyInto() 
 method and check that variable before making the
 deepcopy. I think, it's not necessary to submit that 
 value recursivly to the referers.
  protected $table.JavaName copyInto($table.JavaName 
 copyObj, boolean) throws TorqueException
  {
  
#if ($complexObjectModel)
  if (deepcopy) {
  #foreach ($fk in $table.Referrers)
  ...
  #end
  }
#end
  }
  Maybe I can create a patch for you.
 
 -- 
 This message is automatically generated by JIRA.
 -
 If you think it was sent incorrectly contact one of the 
 administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
 -
 For more information on JIRA, see:
http://www.atlassian.com/software/jira
 
 
 -
 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]



AW: Copying Torque Object

2006-05-29 Thread Thoralf Rickert
Is it useful to make a feature request in JIRA?

 -Ursprüngliche Nachricht-
 Von: Thoralf Rickert [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 24. Mai 2006 15:13
 An: Apache Torque Developers List
 Betreff: Copying Torque Object
 
 
 Hi!
 
 I've a small problem with the copy() and copyInto() methods 
 in the generated Torque objects. I've tables with 
 dependencies from other tables (for example a table login 
 which has a foreign key to a table address). I want to use 
 the BaseAddress.copy() method to copy the address object and 
 save it. If I use this method, it also loads and copies 
 internally all logins which are linked to the source address 
 to the new address. So, it makes a deep copy. Is it possible, 
 to override this behaviour outside the Base* class without 
 creating a totally new
 copy() method? I don't think so...
 
 I've noticed this some time a go and wrote my own copy() 
 method in the extended Address class like this:
 
 public Address copy(boolean deepcopy) throws Exception {
   if (deepcopy)
 return super.copy();
   else {
 Address newAddress = new Address();
 newAddress.setFirstname(firstname);
 
 return newAddress;
   }
 }
 
 But after a little while I've added a new column to the 
 address table and forgot to update the new copy() method too. 
 So I didn't copy all data, if I use copy(false) - which takes 
 some time to find and fix. I can't make a deep copy because 
 there could be many thousands of referer rows to an address. 
 I just want to copy the address data.
 
 So, the best way would be, that this copy(boolean) method 
 should be added during BaseAddress generation in that class. 
 I think, it's not very complicated to add this feature. 
 Here is my proposal:
 
 1. add in Object.vm a new boolean parameter to copy() like this
 public $table.JavaName copy(boolean deepcopy) throws 
 TorqueException
 {
 return copyInto(new ${table.JavaName}(),deepcopy);
 }
 2. create two new downwards compatible methods copy() and copyInto()
 public $table.JavaName copy() throws TorqueException
 {
 return copy(true);
 }
 protected $table.JavaName copyInto($table.JavaName 
 copyObj) throws TorqueException
 {
 return copyInto(copyObject, true);
 }
 3. add a new parameter deepcopy to the old copyInto() method 
 and check that variable before making the
deepcopy. I think, it's not necessary to submit that value 
 recursivly to the referers.
 protected $table.JavaName copyInto($table.JavaName 
 copyObj, boolean) throws TorqueException
 {
 
   #if ($complexObjectModel)
 if (deepcopy) {
 #foreach ($fk in $table.Referrers)
 ...
 #end
 }
   #end
 }
 
 Is that possible or did I forgot something important?
 
 bye
 Thoralf
 
 
 
 -
 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]



[jira] Created: (TORQUE-23) DeepCopy

2006-05-29 Thread Thoralf Rickert (JIRA)
DeepCopy


 Key: TORQUE-23
 URL: http://issues.apache.org/jira/browse/TORQUE-23
 Project: Torque
Type: New Feature

  Components: Generator  
Reporter: Thoralf Rickert
Priority: Minor


I've a small problem with the copy() and copyInto() methods in the generated 
Torque objects. I've tables with dependencies from other tables (for example a 
table login which has a foreign key to a table address). I want to use the 
BaseAddress.copy() method to copy the address object and save it. If I use this 
method, it also loads and copies internally all logins which are linked to the 
source address to the new address. So, it makes a deep copy.

If the object Address has many hundreds related objects of Login this deep 
copy makes a lot that is sometimes not necessary. So, it's better to let the 
user/programmer decide if there program should do a deep copy or not.

The best way would be, that there is a copy(boolean) method that should be 
added during BaseAddress generation. I think, it's not very complicated to add 
this feature. Here is my proposal:

1. add in Object.vm a new boolean parameter to copy() like this
public $table.JavaName copy(boolean deepcopy) throws TorqueException
{
return copyInto(new ${table.JavaName}(),deepcopy);
}
2. create two new downwards compatible methods copy() and copyInto()
public $table.JavaName copy() throws TorqueException
{
return copy(true);
}
protected $table.JavaName copyInto($table.JavaName copyObj) throws 
TorqueException
{
return copyInto(copyObject, true);
}
3. add a new parameter deepcopy to the old copyInto() method and check that 
variable before making the
   deepcopy. I think, it's not necessary to submit that value recursivly to the 
referers.
protected $table.JavaName copyInto($table.JavaName copyObj, boolean) throws 
TorqueException
{

  #if ($complexObjectModel)
if (deepcopy) {
#foreach ($fk in $table.Referrers)
...
#end
}
  #end
}

Maybe I can create a patch for you.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (TORQUE-23) DeepCopy

2006-05-29 Thread Thoralf Rickert (JIRA)
 [ http://issues.apache.org/jira/browse/TORQUE-23?page=all ]

Thoralf Rickert updated TORQUE-23:
--

Attachment: patch.txt

Okay, this is a patch for the Object.vm generated with Eclipse. It creates a 
strange (localized) path to the Object.vm resource. I've changed this in the 
patchfile and hope that is correct.

Additionally I didn't add a public abstract copy(boolean) method, because 
this could generate some errors with existing projects because it changes the 
API.


 DeepCopy
 

  Key: TORQUE-23
  URL: http://issues.apache.org/jira/browse/TORQUE-23
  Project: Torque
 Type: New Feature

   Components: Generator
 Reporter: Thoralf Rickert
 Priority: Minor
  Attachments: patch.txt

 I've a small problem with the copy() and copyInto() methods in the generated 
 Torque objects. I've tables with dependencies from other tables (for example 
 a table login which has a foreign key to a table address). I want to use 
 the BaseAddress.copy() method to copy the address object and save it. If I 
 use this method, it also loads and copies internally all logins which are 
 linked to the source address to the new address. So, it makes a deep copy.
 If the object Address has many hundreds related objects of Login this 
 deep copy makes a lot that is sometimes not necessary. So, it's better to let 
 the user/programmer decide if there program should do a deep copy or not.
 The best way would be, that there is a copy(boolean) method that should be 
 added during BaseAddress generation. I think, it's not very complicated to 
 add this feature. Here is my proposal:
 1. add in Object.vm a new boolean parameter to copy() like this
 public $table.JavaName copy(boolean deepcopy) throws TorqueException
 {
 return copyInto(new ${table.JavaName}(),deepcopy);
 }
 2. create two new downwards compatible methods copy() and copyInto()
 public $table.JavaName copy() throws TorqueException
 {
 return copy(true);
 }
 protected $table.JavaName copyInto($table.JavaName copyObj) throws 
 TorqueException
 {
 return copyInto(copyObject, true);
 }
 3. add a new parameter deepcopy to the old copyInto() method and check that 
 variable before making the
deepcopy. I think, it's not necessary to submit that value recursivly to 
 the referers.
 protected $table.JavaName copyInto($table.JavaName copyObj, boolean) 
 throws TorqueException
 {
 
   #if ($complexObjectModel)
 if (deepcopy) {
 #foreach ($fk in $table.Referrers)
 ...
 #end
 }
   #end
 }
 Maybe I can create a patch for you.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Is Maven really necessary?

2006-05-24 Thread Thoralf Rickert
Yes, you can do it very easy with ant. See 
http://db.apache.org/torque/releases/torque-3.2/generator/index.html and 
http://db.apache.org/torque/releases/torque-3.2/generator/tasks-reference.html

bye
Thoralf



 -Ursprüngliche Nachricht-
 Von: Matthias Klein [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 24. Mai 2006 12:20
 An: torque-user@db.apache.org
 Betreff: Is Maven really necessary?
 
 
 Currently I am writing a small web application using Torque 
 as OM. However, I find it rather cumbersome to heavily depend 
 on Maven only for the Torque part (the rest is dutifully 
 carried out by the tools provided by Eclipse)
 
 Is there no way to somehow perform this task (at least the compilation
 task) without maven?
 
 
 
 
 -
 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]



Caching Rows

2006-04-27 Thread Thoralf Rickert
Hi!

I like to have a feature in Torque that - I think - doesn't exists in it
at present. I could implement it in Torque, but I think it is better to
discuss it first here, because I'm not sure if it possible. Here is my
problem:

I've several tables where the data never changes during runtime of my
application (for example a table called 'currency' which holds every
currency that is used on this planet). These tables hold static data
like state-types etc. They are as good as static because of the lovely
Normalisation.

Here is my feature:
- Add an attribute to the table schema in the xml file (like
cacheRows=true),
  for example:
table name=currency cacheRows=true
  ...
/table

- Build some methods in the Peer like:
   // the cache itself
   protected static HashMapObjectKey,Currency cache = 
new HashMapObjectKey,Currency();

   // get from cache
   public static Currency getCached(ObjectKey key) {
 if (cache.containsKey(key)) return cache.get(key);
 return null;
   }
   // add to cache
   public static Currency setCached(Currency currency) {
 if (currency == null || currency.isNew() || currency.isModified())
return;
 cache.put(currency.getPrimaryKey(),currency);
   }
   // clears the cache and adds all table rows to it
   public static void rebuildCache() {
 ...
   }

- The retrieveByPK() should first check the cache, if the row is there.
If
  it can't find it there, it should read it from the database. If it
finds
  it, it can put the object in the cache:
   public static Currenxy retrieveByPK(...) {
 Currency retVal = getCached(key);
 if (retVal != null) return cached;
 
 ... Get it from the DB
 
 if (retVal != null) setCached(retVal);
 return retVal;


- Change the save() method in the Object Currency like this:
   public void save() {
 ...
 CurrencyPeer.rebuildCache();
   }

   public void save(Connection connection) {
 ...
 CurrencyPeer.rebuildCache();
   }

- Make it possible, to disable Cache Rebuilds for some time (for
example,
  when you create many objects in the table). This could be done by a
  simple switch in the Peer.
   protected boolean rebuild = true;
   
   public static void enableCacheRebuild() {
 rebuild = true;
   }

   public static void disableCacheRebuild() {
 rebuild = false;
   }

  And change the rebuildCache() method:
   public void rebuildCache() {
 if (!rebuild) return;
   }

- Additionally use a Listener concept like TableBameChangeListener to
  inform everybody who is interested in table changes.
   public static void addCurrencyChangeListener(CurrencyChangeListener
listener)
   public static void
removeCurrencyChangeListener(CurrencyChangeListener listener)

I already did this manually in some of my classes and it works fine for
me. This feature cannot be enabled by default to all tables, because it
costs a lot of memory and makes a database obsolet (which isn't what we
want). It should only be used by some tables, that never change there
content. 

I'm not sure if this is useful for someone else? Is there any interest
in this? Or is my solution uncommon?

bye
Thoralf



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Caching Rows

2006-04-27 Thread Thoralf Rickert
Hmm, I've read the documentation some time ago, but it seems to me a little bit 
complicated. But it's very flexible. I'll test it.


 -Ursprüngliche Nachricht-
 Von: Thomas Vandahl [mailto:[EMAIL PROTECTED] 
 Gesendet: Donnerstag, 27. April 2006 11:33
 An: Apache Torque Developers List
 Betreff: Re: Caching Rows
 
 
 Thoralf Rickert wrote:
 
  I've several tables where the data never changes during 
 runtime of my 
  application (for example a table called 'currency' which 
 holds every 
  currency that is used on this planet). These tables hold 
 static data 
  like state-types etc. They are as good as static because of 
 the lovely 
  Normalisation.
 
 See 
 http://db.apache.org/torque/releases/torque-3.2/runtime/refere
nce/managers-cache.html

If you have any questions regarding these features, please ask. I use 
this quite heavily.

Bye, Thomas.


-
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]



AW: [village] Value.asDouble uses Integer.valueOf to parse strings

2006-04-19 Thread Thoralf Rickert
Hmm, yes, I think so.

It should be return Double.valueOf((String)valueObject).doubleValue()

But I'm not sure, what happens with the conversion of NaN in a primitive double 
value...

T.

 -Ursprüngliche Nachricht-
 Von: Jonathan Purvis [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 19. April 2006 06:32
 An: torque-dev@db.apache.org
 Betreff: [village] Value.asDouble uses Integer.valueOf to 
 parse strings
 
 
 I got this exception from Village:
 
 Caused by: com.workingdogs.village.DataSetException: Bad conversion:
 java.lang.NumberFormatException: For input string: NaN
   at com.workingdogs.village.Value.asDouble(Value.java:1046)
 
 It didn't make any sense to me, so i looked at the source 
 code and the Value.asDouble method really does say:
 else if (isString())
 {
 return Integer.valueOf((String) 
 valueObject).doubleValue();
 }
 
 (As found at
 http://svn.softwareforge.de/svn/opensource/village/trunk/src/
java/com/workingdogs/village/Value.java)

Is there a reason for this or is it just a copy'n'paste bug?


Regards,

   Jon



-
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]



AW: Torque with Java5 features

2006-01-23 Thread Thoralf Rickert
 Would you mind to sign a cla and fax it to the ASF office ? 
 see http://www.apache.org/licenses/#clas

Yepp, done.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: using Ant based Torque generator while going thro a HTTP PROXY

2006-01-16 Thread Thoralf Rickert
Yes, have a look at the ant documentation. You have to set a proxy in the ant 
build file, like this.

project
 setproxy proxyhost=192.168.. proxyport=8080 
nonproxyhosts=mylocalhosts,.../

 ...
/project

Is UnknownHostException really a Proxy problem or a DNS problem?...

 -Ursprüngliche Nachricht-
 Von: Naveen Murthy [mailto:[EMAIL PROTECTED] 
 Gesendet: Montag, 16. Januar 2006 16:18
 An: torque-user@db.apache.org
 Betreff: using Ant based Torque generator while going thro a 
 HTTP PROXY 
 
 
 hello;
 
 im using ANT based  torque-gen-3.2  for generating Java Peer 
 files. It works fine when im directly connected to the network.
 
 but when im connecting to net via a PROXY server, the 
 generator fails using  java.net.UnknownHostException: db.apache.org
 
 Is there way or an OPTION to indicate the presense of a PROXY server?
 
 thanks!
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: proposal for reorganizing the Torque site

2006-01-16 Thread Thoralf Rickert
Hi!

I think, it's a good idea to reorganize the website. I'd a look and two or 
three comments:

- When you select the Documentation link in the menu you see a lot of options 
in the content (Runtime, Generator and so on). When you click on one of this 
options the menu changes and you see the selected option also in the menu. I 
think this isn't 'ergonomic'. First you have to change your focus from the menu 
to the content and then the menu-content changes in a way that you wonder why 
you've to change your focus. Also you've to go back to the first documentation 
content page to reach another tree in the documentation (for example when you 
want to switch from runtime to generator). I think, it's better, when the menu 
shows always all possible (main) options, like this:

   Documentation
 Torque 3.2 Runtime
 Torque 3.2 Generator
 ...
 Older Torque Releases

...maybe without version number...

- Then - if possible - paths are nice features to view the current position on 
the site. Above the menu there is enough space to insert a path like this:

   Home / Documentation / Torque 3.2 / Runtime

I think, this could be an additional way to show the user where he is.

- The next point is more content based. There is a menu point called Wiki which 
points to a Wiki. I'm not sure if I understand this wiki system. Is it a user 
communication platform or a new documentation area. Should the wiki not be part 
of the documetation tree? And is it really useful to have two different 
documentation systems (I'm sure there are some very useful hints in the wiki 
that are not part of the offical documentation and vice versa).

Also I think, the documetation is really much too maven oriented. It's really 
easy to work with torque and ant. I think, this should be more highlighted.


bye
Thoralf

 -Ursprüngliche Nachricht-
 Von: Thomas Fischer [mailto:[EMAIL PROTECTED] 
 Gesendet: Freitag, 13. Januar 2006 21:14
 An: torque-dev@db.apache.org
 Betreff: proposal for reorganizing the Torque site
 
 
 Hi,
 
 In the last months, I grew more and more uncomfortable with 
 the current 
 organisation of the Torque homepage, http://db.apache.org/torque.
 
 The things I like least about it are
 
 - when you change to a component of Torque (e.g. the 
 runtime), the menu on 
 the left hand side jumps and you cannot get back via the 
 menu to the 
 overview (you have to discover the links in the header)
 
 - There is a lot of information scattered in the homepage, 
 but it is very 
 difficult to locate the information.
 
 So I went for it and tried to design a new page organisation, 
 where the 
 issues above are resolved. The suggestion can be found at 
 http://people.apache.org/~tfischer/torque-docs/
 
 Please have a look and write back whether you like the 
 reorganisation or 
 not. I have rewritten and reviewed a lot of information in 
 the runtime 
 (that was where the chaos was largest because that was once 
 our top-evel 
 page), but of course also the new site is not perfect (though in my 
 opinion it is loads better than our present site). I am 
 grateful for any 
 hint what is missing or wrong (e.g. I did not yet incorporate Greg's 
 suggestion for an ant user guide), but please also judge the general 
 concept.
 
 Implementation Details:
 The method to avoid the jumping menu is to create a skeleton menu 
 for the site which is incorporated in every component 
 (basically this is 
 the part of the menu where all items are closed) The disadvantage of 
 this is that it is very difficult to change that skeleton 
 after publishing 
 the site, so I tried hard to create a very general skeleton.
 
 I had to create two new subcomponents of Torque for this. One is the 
 tutorial (which in my opinion should live in its own 
 component, anyway), 
 the other is docs-all-components where versioned docs which are not 
 attributable to a single Torque component (e.g. the database 
 howtos) are 
 located.
 
 This is just a suggestion. I did not check in any of this to svn.
 
I look forward to hear your opinion
 
  Thomas
 
 
 -
 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]



AW: Mapping column types

2005-12-27 Thread Thoralf Rickert
   I have the exact same problem. After some debugging, I 
 found out that 
 the problem lies on the way village translates the output of the jdbc 
 driver. The drivers returns an integer for the fields of type 
 bit (1 for 
 true, 0 for false). Village obviously (I don't have the source code) 
 tries to parse the int value using the method 
 Boolean.parseBoolean(int[], int, int), which returns false in 
 either case... After a brief search, I wasn't able to find 
 the source code and see If I 
 could create a simple patch.

The source is here:
http://www.softwareforge.de/releases/village/distributions/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Torque with Java5 features

2005-12-23 Thread Thoralf Rickert
Okay, now I've 'cheated' the OM templates in Torque 3.2 to enable Java5 
features. I've tested the Peer and Object generation. Everything else is 
untested (Managers and Beans) but implemented as good as possible. The 
templates are currently Java5 enabled. You have to UNSET the 
enableJava5Features variable. This makes it possible to define a 
configuration key and make the variable visible, when the configuration file 
this says. So I didn't change the Torque Source code (that's maybe you task).

http://thoralf.log-out.net/tmp/java5enabled-templates.zip

Merry Christmas
Thoralf


  -Ursprüngliche Nachricht-
  Von: Thoralf Rickert
  Gesendet: Freitag, 25. November 2005 12:07
  An: 'Apache Torque Developers List'
  Betreff: AW: Torque with Java5 features
  
  
   Just to make sure that I understood you correctly: You 
 were able to 
   convert the templates without chamnging the Runtime jar, and it 
   worked ?
  
  Jo.
  
   - Testing would be more complicated. At the moment, it is 
 already a 
   nuisance to change the databases by hand, and to change 
 the idtable 
   property by hand. To not spend my life testing, I do 
 admit I usually 
   do not switch other parameters. So this would add another 
 parameter 
   to be
   switched; this gets to a point where something atomatic would
   have to be written.
  
  Just thinking: What about a script that compiles and verifies
  each possible configuration?
  
   - We already have too many generator parameters. We need to think 
   about that problem. But I would guess in this case, a 
 configuration 
   parameter would be the only sensible way (maintaining two sets of 
   templates, with managers and withou them, is a nuisance 
 already, I 
   would not want another
   split)
   - In my eyes, it is certainly a nice feature, but it is not
   the first in my personal list of priorities for after 3.2. I 
   would support it if it would be done, but I would not do 
 it myself.
  
  Because I would chance our torque environment to 3.2 after
  you've released it, I would also change the templates again 
  to use them with Java5. So it would be a clear start for me 
  and no problem to submit it back to you.
  
  But I don't have such a complex test environment. We use only
  the Object and Peer Templates. So I don't know, if it is 
  possible to change the Manager to Java5. Do you've a 
  documentation, which discribes, what you're testing?
  
  bye
  Thoralf
  
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



XML-Description to Java SQL Comment

2005-12-15 Thread Thoralf Rickert
Hi!

I've a small feature request...

In the XML schema it is possible to declare descriptions on table an
column tags. I think, this attribute is currently unused. I've made some
changes in the OM templates and now I can see this descriptions in the
comments in the generated java classes (so it's easier to understand
what a setter or getter method means).

Additionally I made this changes in the mysql templates table and column
and now I can see this description also in the database (for example via
phpMyAdmin). I'm not sure if this syntax is also usable in other
database types...

Here are my changes (for the moment):

om/Object.vm (SVN345880):
 At the top of the class is a Java comment area, which I've 
 enhanced with a new line before line 74:
  * $!{table.description}
 In the foreach loop where the setters and getters are generated
 I've added the following line to the java comment (line 148 and 170).
  $!{col.description}

In om/Peer.vm, om/ExtensionPeer.vm and om/ExtensionObject.vm I've added
only the table comment ($!table.description} in the javaclass comment
(line 55,17 and 27). That's it.


The SQL generation in MySQL isn't so easy, because I'm using currently
Torque 3.1. Here are the theoretical changes:
sql/base/mysql/table.vm:
Line18:
  #if($table.description)
#set($description= COMMENT='$table.description')
  #else
#set($description=)
  #end

And then replace the ); with )${description};

The columns can only be changed by changing the java source code in
org.apache.torque.engine.database.model.Column.getSqlString() (why
that?). But it's like the changes in the table.vm. The syntax is like
this:
absentee_id BIGINT NOT NULL COMMENT 'my comment',

Maybe someone finds this useful and wants to use/implement it.

bye
Thoralf



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: CamelCase, Object Population and Relational Selects

2005-12-07 Thread Thoralf Rickert
 Question 1: Is there a way to maintain the CamelCase of the tables 
 inside of the torque classes? ex: If I have a table named 
 accountTypes I get classes such as AccounttypesBase, AccounttypesPeer
 and Accounttypes. 
 Is it possible to get proper casing out of Torque like 
 AccountTypesBase?

See docs:
table name=accountTypes javaName=AccountType
...
/table


 Question 2: We are considering integrating with Torque and the object
 model it creates more tightly. Currently we don't use the generated
 classes much at all besides querying the database then pulling the
 information out of the objects and translating it into something more
 usable from a java perspective.

Hmmm, perhaps Torque is not what you need. But I'm not sure if there is
a framework that puts your database tables in a usable java
perspective. Torque isn't able to understand the background of your
database design. 

 [...]
 example:
 say there is a OM class called Account that relates to Company in the 
 database. Is there a way to get an Account object with a List 
 of Company 
 instead of a List of Account each one containing a Company object.

I'm a little bit confused about that example. Has Account a foreign key
to Company...

Then there will never be more then one company for one account.

... or is there something like a link table between Account and Company
(f.e. AccountCompanyAssignment)?

Then make a select with the account in the AccountCompanyAssigment and
join the companies. You will get a list of AccountCompanyAssignments.
Extract the companies from that list in a wrapper method in
AccountCompanyAssignmentPeer and return the list of companies:

public static List getCompanies(Account account) throws Exception {
  Criteria criteria = new Criteria();
  criteria.add(ACCOUNT_ID, account.getID());
  criteria.addGroupByColumn(COMPANY_ID);
  List result = doSelectJoinCompany(criteria);
  List companies = new ArrayList();

  for (AccountCompanyAssigment assignment : result)
companies.add(assigment.getCompany());
  
  return companies;
}



 Question 3: I see that there is a way to join against related tables, 
 and also a way to join against all related tables except a 
 certain one. 
 Perhaps it's a gross oversight on my behalf but is there a 
 way to join 
 against ALL relationships?

Create your own method by copying a doSelectJoinAllExcept*() method and
add the excepted related table. It's not difficult. I think there was
something in the documentation about this.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Torque with Java5 features

2005-11-25 Thread Thoralf Rickert
Hi!

I'm not sure, if this feature was discussed already on this list, but
how big is the chance, that torque supports the Java5 features, like
generics, in a future version? I know that this means a lot of work and
much trouble with users, who aren't able to use Java5 because of some
restrictions or what ever. But it has some very useful addons. For
example a generated doSelect could return a ListTableA. That makes
runtime errors - because of wrong class casts - obsolete.

After Sun's launch of the Java5 version, I had changed most of the class
generation templates in torque 3.1 (object,peer,map) to use this
features in our whole application without any breakage (til
BasePeer...). That tooks me 4-5 hours and wasn't really complicated. But
it's practically a branch, because older Java compiler aren't able to
compile this generated classes. And I know it's not useful to maintain
two source tree for pre Java5 and Java5.

I think it could be possible to create templates that are able to
generate preJava5 and Java5 version by using a switch in the
configuration. For example a switch called torque.java5, which could be
true or false could be used to output the best java source code. For
example:

public static java.util.List#if($torque.java5)${table.JavaName}#end
doSelect(Criteria criteria) throws org.apache.torque.TorqueException
{
  return populateObjects(doSelectVillageRecords(criteria));
}

It's not nice, but it could work. The other part (converting the
generator and the runtime libraries) is another problem... 

But for now I'm just asking, if this is on your plan?

bye
Thoralf




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Torque with Java5 features

2005-11-25 Thread Thoralf Rickert
 Just to make sure that I understood you correctly: You were 
 able to convert the templates without chamnging the Runtime 
 jar, and it worked ? 

Jo.

 - Testing would be more complicated. At the moment, it is 
 already a nuisance to change the databases by hand, and to 
 change the idtable property by hand. To not spend my life 
 testing, I do admit I usually do not switch other parameters. 
 So this would add another parameter to be
 switched; this gets to a point where something atomatic would 
 have to be written.

Just thinking: What about a script that compiles and verifies each
possible configuration?

 - We already have too many generator parameters. We need to 
 think about that problem. But I would guess in this case, a 
 configuration parameter would be the only sensible way 
 (maintaining two sets of templates, with managers and withou 
 them, is a nuisance already, I would not want another
 split)
 - In my eyes, it is certainly a nice feature, but it is not 
 the first in my personal list of priorities for after 3.2. I 
 would support it if it would be done, but I would not do it myself.

Because I would chance our torque environment to 3.2 after you've
released it, I would also change the templates again to use them with
Java5. So it would be a clear start for me and no problem to submit it
back to you.

But I don't have such a complex test environment. We use only the Object
and Peer Templates. So I don't know, if it is possible to change the
Manager to Java5. Do you've a documentation, which discribes, what
you're testing?

bye
Thoralf



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: SQL generated schema

2005-11-18 Thread Thoralf Rickert
Hi!

I think, the second approach is possible without much work. I did three things 
to use ALTER TABLEs.

1. I've added a new for-loop in the sql/base/Control.vm at the end
   of the foreach datamodel loop. This loop goes through all tables
   and calls a new template called alter-table.vm in the desired
   database type.

   #foreach ($dataModel in $dataModels)
[...]
#foreach ($table in $database.tables)
 $generator.parse($basepath/alter-table.vm,$outFile,table,$tbl)
#end
   #end

2. I've created the alter-table.vm in the mysql template directory
   (sql/base/mysql) and added the ALTER TABLE command.

   #foreach ($fk in $table.ForeignKeys)
ALTER TABLE $table.Name add FOREIGN KEY ($fk.LocalColumnNames)
  REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)
  #if ($fk.hasOnUpdate()) ON UPDATE $fk.OnUpdate #end
  #if ($fk.hasOnDelete()) ON DELETE $fk.OnDelete #end;
   #end

3. I've deleted the content from the /sql/base/mysql/foreignkey.vm which
   is responsible for the foreign key creating in the CREATE TABLE
   command.

So, there is just one point to do in every DB Template. Create an empty 
alter-table.vm template. That is done in 2 minutes. And if somebody has a patch 
for a specific database type, he/she can change the alter-table.vm and delete 
the content from foreignkey.vm as I did it. That's it.

bye
Thoralf



 -Ursprüngliche Nachricht-
 Von: Greg Monroe [mailto:[EMAIL PROTECTED] 
 Gesendet: Donnerstag, 17. November 2005 17:22
 An: Apache Torque Users List
 Betreff: RE: SQL generated schema
 
 
 One issue is that this problem is not specific to MySQL.  I 
 know it exists in MS SQL (a variation is even mentioned in 
 the new HowTo). I strongly suspect that most DB servers will 
 have problems defining keys that point to tables that don't exist yet.
 
 So, to truly fix this problem, it should be addressed for all 
 DB types and not just MySQL. 
 
 IMHO, there are three possiblities here.  The first is simply to 
 document better that master tables need defined first in the 
 XML file and to point out that generated SQL for cross-keyed 
 tables will need to be manually modified to work.
 
 The second and maybe hardest is to truly change the format of 
 the SQL generated by Torque to create tables first and then do 
 Alter Table statements later to add in constraints.  This 
 probably means that all the DB Templates will need to be 
 overhauled.. sigh.
 
 On the bright side, the SQL99 standard does include ALTER TABLE ADD 
 Constraints, but constraint mgmt is listed as an optional feature.  
 I'd guess that most modern SQL DB implimentations support it 
 though. So the template changes should be easier... but they 
 still need to be tested against all the DB's torque supports... sigh.
 
 Finally, an easier to impliment but doesn't fix all situations (this 
 one in particular) would be to do some XML syntax checking and throw 
 an error if a foreign table was used before it was defined.  This 
 would be easier because the XML format is the same for all DBs.  
 Unfortunately, it would also break any schema's where tables had 
 cross keys.  I also think there might be issues with the new 
 multiple schema file support here.
 
 Anyway, at a minimum, an overall strategy needs to be opted for.  
 Then a general Scarab issue for this needs to be defined.  If it 
 requires DB specific changes, then this issue could be used to 
 track which DB's have been fixed until it can be totally closed.
 
 Hmm, is this really a ddlutils project issue and it could be 
 pawned off on that?  8)
 
  -Original Message-
  From: Thoralf Rickert
  
  
  I don't think that there is really a problem with torque and
  mysql. Normally everything is fine, but at that time 
  something like this, doesn't worked:
  
   table name=tableA
  
foreign-key foreignTable=tableB
  reference local=tableB_id foreign=id/
/foreign-key
   /table
  
   table name=tableB
column name=idrequired=true type=BIGINT 
  primaryKey=true autoIncrement=true/
column name=tableA_id type=BIGINT/
  
index name=tableA_index
 index-column name=tableA_id/
/index
  
foreign-key foreignTable=tableA
  reference local=tableA_id foreign=id/
/foreign-key
   /table
  
  MySQL will quit this with an error, because it doesn't know
  tableB during the CREATE TABLE tableA. So it's not a bug. 
  But it could be a feature :-).
  
  I looked into the current subversion template and I think
  that the example above doesn't work with the current version 
  (including 3.2). But my locally changed version is able to 
  manage this. I think, it's better to upgrade my local version 
  to torque 3.2 and make then a patch.
  
  bye
  Thoralf
  
  
  
   -Ursprüngliche Nachricht-
   Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
   Gesendet: Mittwoch, 16. November 2005 10:20
   An: Apache Torque Users List
   Betreff: AW: SQL generated schema

  1   2   >