Re: 3.3.1 to 4.0 migration

2015-07-07 Thread Thomas Fox
Hi Helge

 Helge Weissig wrote:

 Just a quick follow-up to report on progress on the template conversions. 
 I managed to get the single mergepoint override working by changing the order 
 of outlets and mergepoints. 
 As for the bean classes, I was able to just use the baseBean.vm template and 
 it’s outlet directly from the distribution.
 
 Let me know if you are still interested in the two patches I mentioned below.

Sorry not to answer sooner. There is not much time nowadays for me and Torque.
I'm glad you got it finally working. Are there still open questions?
Yes, I'm still interested in the two patches. Please create jira issues.

Thanks,

  Thomas

 cheers,
 h.


 On Jul 2, 2015, at 5:04 PM, Helge Weissig hel...@grajagan.org wrote:
 
 Thanks Thomas! Some comments and follow-up questions below:
 
 On Jul 1, 2015, at 6:03 PM, Thomas Fox thomas@seitenbau.com wrote:
 
 Helge Weissig wrote:
 
 I forgot about the HTML filter this group uses… pardon the crappy 
 formatting. 
 Here is a text-only version:
 
 Our code base is heavily invested in some of the functionality removed from 
 torque 4.0 
 and I was wondering if any one had some advice on a migration path:
 
 1. We make extensive use of village records obtained via 
BasePeer.doSelect(Criteria), for example. 
Those results could probably be considered a view of the data
and I am wondering if that would be the correct/recommended/best 
 approach.
 
 If you are using this to read data only, have a look at the RecordMapper 
 functionality. A record mapper maps DB Columns to an object. You can use 
 different record mappers for the same table (e.g. it can be passed in 
 through SomePeer.doSelect(Criteria, RecordMapperTT), so have different 
 object representations. For a generic village-record-like representation, 
 see org.apache.torque.om.mapper.ObjectListMapper (personally I do not like 
 this representation, put perhaps it serves your needs). Views (now supported 
 !) are also a more db-centric option. 
 
 It looks like RecordMapper may ultimately be the best way to go although I 
 still like the idea of using views because it would simplify the assembly of 
 criteria in our code and allow for some generalization as well.
 
 
 2. We have added our own caching implementation 
(configurable via the schema definition) to the Object.vm 
and Peer.vm templates. I have read through the new generator 
 documentation 
and the customization part of the OR Mapping Reference 

 (https://db.apache.org/torque/torque-4.0/documentation/orm-reference/customizing-generation.html)
but I don’t seem to be able to find the relevant information 
to put it all together. Basically, I would like to override one or 
 more templates.
I think I know how to specify that in an outlet, but do I also need 
 the control configuration
in the conf directory? The maven plugin (we use maven) has 
 configuration parameters 
for overrideConfigDir and overrideConfigPackage… do I need to set 
 those?
 
 Have you checked the code-gen tutorial 
 (http://db.apache.org/torque/torque-4.0/documentation/tutorial/orm/index.html)
  for a basic understanding ?
 Also, there is an example in the torque test project 
 (https://svn.apache.org/repos/asf/db/torque/torque4/trunk/torque-test/src/main/torque-gen)
  which basically does what you want, i.e. overrides the Peer template 
 (adding @SuppressWarnings annotations). The torque generation config which 
 invokes this can be found in 
 https://svn.apache.org/repos/asf/db/torque/torque4/trunk/torque-test/pom.xml 
 lines 183ff.
 To be more specific:
 Yes, you need at least an empty control configuration.
 You need to set either overrideConfigDir or overrideConfigPackage, depending 
 whether the additional templates can be found in the file sytsem or in the 
 classpath.
 Please ask again if you cannot get it working. Although more complicated 
 :-(, the new generator is much more extensible than the old one. In the 
 current trunk, you can even use groovy templates :-)
 
 OK, I am getting somewhere, my outlets and templates are now found, alas I am 
 having trouble achieving the desired results. For one, I am not able to get 
 the example at the bottom of 
 http://db.apache.org/torque/torque-4.0/documentation/codegen-reference/configuration.html
  
 http://db.apache.org/torque/torque-4.0/documentation/codegen-reference/configuration.html
  
 http://db.apache.org/torque/torque-4.0/documentation/codegen-reference/configuration.html
  
 http://db.apache.org/torque/torque-4.0/documentation/codegen-reference/configuration.html
  to work. I get an error about a missing outlet tag. I think if I could 
 actually override just a specific mergepoint, that would get me 90% of the 
 way. However, we also modified the Bean.vm template to allow us to continue 
 using fields like “modified” or “new” in our DB schema. Those attributes

Re: 3.3.1 to 4.0 migration

2015-07-01 Thread Thomas Fox
Helge Weissig wrote:

 I forgot about the HTML filter this group uses… pardon the crappy formatting. 
 Here is a text-only version:

 Our code base is heavily invested in some of the functionality removed from 
 torque 4.0 
 and I was wondering if any one had some advice on a migration path:

   1. We make extensive use of village records obtained via 
  BasePeer.doSelect(Criteria), for example. 
  Those results could probably be considered a view of the data
  and I am wondering if that would be the correct/recommended/best 
 approach.

If you are using this to read data only, have a look at the RecordMapper 
functionality. A record mapper maps DB Columns to an object. You can use 
different record mappers for the same table (e.g. it can be passed in through 
SomePeer.doSelect(Criteria, RecordMapperTT), so have different object 
representations. For a generic village-record-like representation, see 
org.apache.torque.om.mapper.ObjectListMapper (personally I do not like this 
representation, put perhaps it serves your needs). Views (now supported !) are 
also a more db-centric option. 

   2. We have added our own caching implementation 
  (configurable via the schema definition) to the Object.vm 
  and Peer.vm templates. I have read through the new generator 
 documentation 
  and the customization part of the OR Mapping Reference 
  
 (https://db.apache.org/torque/torque-4.0/documentation/orm-reference/customizing-generation.html)
  but I don’t seem to be able to find the relevant information 
  to put it all together. Basically, I would like to override one or 
 more templates.
  I think I know how to specify that in an outlet, but do I also need 
 the control configuration
  in the conf directory? The maven plugin (we use maven) has 
 configuration parameters 
  for overrideConfigDir and overrideConfigPackage… do I need to set 
 those?

Have you checked the code-gen tutorial 
(http://db.apache.org/torque/torque-4.0/documentation/tutorial/orm/index.html) 
for a basic understanding ?
Also, there is an example in the torque test project 
(https://svn.apache.org/repos/asf/db/torque/torque4/trunk/torque-test/src/main/torque-gen)
 which basically does what you want, i.e. overrides the Peer template (adding 
@SuppressWarnings annotations). The torque generation config which invokes this 
can be found in 
https://svn.apache.org/repos/asf/db/torque/torque4/trunk/torque-test/pom.xml 
lines 183ff.
To be more specific:
Yes, you need at least an empty control configuration.
You need to set either overrideConfigDir or overrideConfigPackage, depending 
whether the additional templates can be found in the file sytsem or in the 
classpath.
Please ask again if you cannot get it working. Although more complicated :-(, 
the new generator is much more extensible than the old one. In the current 
trunk, you can even use groovy templates :-)

   3. This is more of a maven question, maybe, alas I have the feeling
  it isn’t actually possible to implement through it, but is there a 
 way
  to skip the code generation steps if the schema sources have not 
 changed?

Sorry, this is not any more possible. The problem is to reliably find out 
whether the file has changed (e.g. some OS do not change the change date of a 
file when it is copied). I have seen more than one situation where schema 
changes did not get picked up because of this option, so my personal 
recommendation is not to rely on such a mechanism. Also, mvn generate is 
typically not executed often while developing, so long generation times should 
not slow down development too much.
However, if you still want to use it, you can patch the Mojo class in the 
Torque maven plugin, this should not be too difficult (please share if you 
choose to do it).

   4. I know how to configure logging for the generator, but the switch 
 between loglevel
  WARN and INFO is quite severe. Is there a way to log at INFO level 
 but only to a file, 
  not to the console? We use log4j throughout our project.

Yes, check the log4j configuration documentation. Basically you need to 
override the log4j configuration file and use two appenders, one file appender 
and one console appender, with different log levels. The log4j configuration 
needs to be in the classpath /org/apache/torque/generator/log4j.properties and 
it must have a higher classpath priority than the torque-generator.jar (I am 
currently not sure how to achieve this using maven, the last resort is patching 
the generator)

Good luck!

   Thomas

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



Re: generate enum from db at runtime

2014-10-15 Thread Thomas Fox
Ok so the agreement is that colum enums should be supported but table enmus 
should not. 

Thomas 

- Ursprüngliche Mail -

Von: Youngho Cho youngho1...@gmail.com 
An: Thomas Fox thomas@seitenbau.com 
Gesendet: Mittwoch, 15. Oktober 2014 12:18:33 
Betreff: Re: Fwd: generate enum from db at runtime 



Hello Thomas 
you are right ! 
I don't need primary value in the enum. 
I have.getByName Method in the manager. 
So only NameValue is ABSOLUTELY right! 

Thanks. 

Youngho 
2014. 10. 15. 오후 4:53에 Thomas Fox  thomas@seitenbau.com 님이 작성: 


- Forwarded Mail - 
Von: Thomas Fox  thomas@seitenbau.com  
An: Apache Torque Users List  torque-user@db.apache.org  
Gesendet: Mittwoch, 15. Oktober 2014 09:52:13 
Betreff: Re: generate enum from db at runtime 

Hi Youngho, 

I am afraid my current draft does not allow TABLE enums (as you use), only 
COLUMN enums (which was my primary use case). 
I now see that your use case also makes sense, I did not think of it before. 

For your current ROLE table, do you need the ROLE_NAME in database? 
If not, you could still use the column enum solution for the id column. 

I need to think about whether it would be possible to make Tables enum. 
Perhaps something like this 

table name=TURBINE_ROLE idMethod=idbroker isEnum=true 
column name=ROLE_ID required=true primaryKey=true type=INTEGER 
enum-value value=1/ 
enum-value value=2/ 
enum-value value=3/ 
/column 
column name=ROLE_NAME required=true size=99 type=VARCHAR 
javaName=Name 
enum-value value=Guest/ 
enum-value value=Member/ 
enum-value value=Owner/ 
column 
unique 
unique-column name=ROLE_NAME/ 
/unique 
/table 

Obviously, there needs to be the same number of enum-value elements for each 
column for this to work. 

About primary keys: in most databases you can define primary key values 
although the database can determine it itself. 
So in your case It should be possible to fill the TURBINE_ROLE table by a 
manual SQL where you determine the id (and not the database). 
Besides: is there any reason you use idbroker? All currently supported 
databases have a native mechanism to create ids. 

Thomas 

- Ursprüngliche Mail - 
Von: Youngho Cho  youngho1...@gmail.com  
An: Thomas Fox  thomas@seitenbau.com  
CC: Apache Torque Users List  torque-user@db.apache.org  
Gesendet: Mittwoch, 15. Oktober 2014 09:25:25 
Betreff: Re: generate enum from db at runtime 

Hello Thomas, 

Ah now I understand your previous message regarding reverse engineering. 

The primary key information is allocated by the inserting the role 
therefore torque generator has no way to know the primary key value 
when it generate the enum 

Umm.. 

But we can set the primary key value in the schema enum-value, don't you ? 

also the description value is also needed as you mentioned in the jira. 


Thanks, 

Youngho 

2014-10-15 15:52 GMT+09:00 Youngho Cho  youngho1...@gmail.com : 
 Hello Thomas, 
 
 I generate enum with your working draft for TORQUE-331. 
 Looks very cool feature !. 
 
 I would like to give to my enum usage with om object. 
 ( I am not sure how you use enum with om but please let me know you my usage 
 ) 
 
 For the role table 
 
 table name=TURBINE_ROLE idMethod=idbroker 
 column name=ROLE_ID required=true primaryKey=true type=INTEGER/ 
 column name=ROLE_NAME required=true size=99 type=VARCHAR 
 javaName=Name/ 
 unique 
 unique-column name=ROLE_NAME/ 
 /unique 
 /table 
 
 I made RoleEnum.java manually likes 
 ( enum members are existing column values in the database) 
 
 public enum RoleEnum 
 { 
 Guest(1, Guest), 
 Member(2, Member), 
 Owner(3, Owner); 
 
 private Integer id; 
 private String name; 
 
 private RoleEnum(final Integer id, final String name) 
 { 
 this.id = id; 
 this.name = name; 
 } 
 
 public Integer getId() 
 { 
 return this.id ; 
 } 
 
 public String getName() 
 { 
 return this.name ; 
 } 
 
 public TurbineRole getInstance() 
 throws TorqueException 
 { 
 return TurbineRoleManager.getInstance(getId()); 
 } 
 
 public boolean represent(TurbineRole role) 
 { 
 return this.id.equals(role.getRoleId()); 
 } 
 
 public static SetRoleEnum getAllEnum() 
 { 
 return EnumSet.allOf(RoleEnum.class); 
 } 
 } 
 
  
 And add method in TurbineRole.java 
 
 public RoleEnum getEnum() 
 { 
 return RoleEnum.valueOf(getName()); 
 } 
 
 
  
 At the java code or template I use 
 
 Role role = RoleEnum.valueOf(cond.getValue()).getInstance(); 
  
 
 or 
 
 if(RoleEnum.Guest.represent(role)){ 
  
 } 
 
 .. 
 
 using custom template, we can add custom method for their usage. 
 But for the the enum private fields, I hope that 
 we need unique name and their primary key value also I think. 
 
 Thanks, 
 
 Youngho 
 
 
 2014-10-10 16:49 GMT+09:00 Thomas Fox  thomas@seitenbau.com : 
 Hi Youngo 
 
 Torque is built on the idea that the database schema is static, i.e. does 
 not change at runtime

Re: generate enum from db at runtime

2014-10-10 Thread Thomas Fox
Hi Youngo

Torque is built on the idea that the database schema is static, i.e. does not 
change at runtime, and that the database structure is defined in the schema 
file, not in the database.
There is some benefit in reverse-engineering from the database, however it is 
also a very difficult and large field. The Torque main path is to define the 
structure in the schema xml file and then re-run the generator, not to change 
the database and re-engineer it.
Therefore, to support enums, I have created a ticket in Jira 
https://issues.apache.org/jira/browse/TORQUE-331, which supports enum 
definition in the schema.xml. I'm currently working on it, because I have also 
missed the enum feature.

To elaborate the reverse engineering from the database: The generator can 
generate a schema file from the database, but it is not in the core focus of 
the Torque team and only works for very coarse features. See 
http://db.apache.org/torque/torque-4.0/documentation/orm-reference/running-the-generator.html#Generation_of_XML_schema_from_an_existing_database.
 However, if you'd like to improve it, please go ahead.

  Thomas

- Ursprüngliche Mail -
Von: Youngho Cho youngho1...@gmail.com
An: Thomas Fox thomas@seitenbau.com
CC: Apache Torque Users List torque-user@db.apache.org
Gesendet: Donnerstag, 9. Oktober 2014 09:06:17
Betreff: Re: generate enum from db at runtime

Hello Thomas,

I think generated at runtime was a little exaggerated expression
because of my lack of english expression.

It means that
If ROLE table changed by adding a new role such as 'Owner' Role,
than some task run torque generator to generate new RoleEnum class
which is include the Owner.

If torque has an ability to read database and generate corresponding
enum, I think it is very useful feature.
( It is very cumbersome work to add/remove by hand whenever some kind
of type table changed)

And your eum with om usage tip is very helpful to me.
Thanks a lot.

Thanks,

Youngho


2014-10-08 21:36 GMT+09:00 Thomas Fox thomas@seitenbau.com:
 Hi Youngho,

 currently it is not possible to generate enums. This would be an interesting 
 feature in my opinion.
 It needs to be seen whether this requires a schema change.

 I'm not sure what you mean by generated at runtime.

 What I currently do when I need an enum is to define internal methods which 
 take and return strings and on top of that hand-written methods which take 
 and return the enum. It looks something like:

 in the schema:
 column name=role type=VARCHAR javaName=roleInternal /

 in the data object (assuming Role is an enum):
 public void setRole(Role role)
 {
   super.setRoleInternal(Role.toString());
 }

 public Role getRole()
 {
   return Role.valueOf(super.getRoleInternal());
 }

 // only for torque's internal use
 @Deprecated
 @Override
 public String getRoleInternal()
 {
   return super.getRoleInternal();
 }

 // only for torque's internal use
 @Deprecated
 @Override
 public void setRoleInternal(String role)
 {
   super.setRoleInternal(role);
 }

 Thomas

 - Ursprüngliche Mail -
 Von: Youngho Cho youngho1...@gmail.com
 An: Thomas Fox thomas@seitenbau.com, Apache Torque Users List 
 torque-user@db.apache.org
 Gesendet: Mittwoch, 8. Oktober 2014 08:32:10
 Betreff: generate enum from db at runtime

 Hello Thomas,

 Can torque generate enum class from database ?

 For example,

 following turbine-fucrum-torque security model

 http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/schema/fulcrum-turbine-schema.xml?revision=1575232view=markup

 has Role, Permission table.

 And It can be added during system running.

 When those table column added/removed,
 I hope to running maven-plugin or ant target etc.. to generate
 corresponding enum class.

 Is it possible senario ?


 Thanks,

 Youngho

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


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


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



Re: 3.3 to 4.0 migration

2014-09-25 Thread Thomas Fox
I have personally never used the getRelatedObjects(Criteria) methods and do not 
like that they cache their results.

However, since the results are cached and serialized, and it is unclear how the 
result was obtained except for the cached criteria,
in my opinion the criteria which was used to obtain the result should also be 
serialized.

Personally, I'd prefer not to cache the result of getRelatedObjects(Criteria), 
but I'm afraid there are users which rely on it.

   Thomas

Youngho Cho wrote:

Hello Thomas,

I read the torque-4.1 generator generated file.
and I have one question

When torque.om.objectIsCaching set true
Than following Criteria object set.

/**
 * The criteria used to select the current contents of $field
 */
private Criteria $criteriaCacheField = null;


During 3.3, I have always curious that Why we don't use transient keyword likes

private transient Criteria $criteriaCacheField = null;

is there any merit to keep this object during serialization process ?


Thanks,

Youngho


2014-09-24 21:27 GMT+09:00 Youngho Cho youngho1...@gmail.com:
 Hello Thomas,


 Thanks for your kind consideration.

 Youngho

 2014-09-24 21:07 GMT+09:00 Thomas Fox thomas@seitenbau.com:
 It will be great if schema-reference document exists like torque-3.3
 https://db.apache.org/torque/torque-3.3/releases/torque-3.3/generator/schema-reference.html


 I created a jira issue for it.

Thomas


 - Ursprüngliche Mail -
 Von: Youngho Cho youngho1...@gmail.com
 An: Thomas Fox thomas@seitenbau.com
 Gesendet: Mittwoch, 24. September 2014 07:11:02
 Betreff: Re: 3.3 to 4.0 migration

 Hello Thomas,

 Ah
 I read
 https://issues.apache.org/jira/browse/TORQUE-309

 I understand Why my previous email error happened.

 It will be great if schema-reference document exists like torque-3.3
 https://db.apache.org/torque/torque-3.3/releases/torque-3.3/generator/schema-reference.html

 than the toque 4.0 user can understand much more it.


 Thanks,

 Youngho


 2014-09-24 13:53 GMT+09:00 Youngho Cho youngho1...@gmail.com:
 Hello Thomas,

 In order to learn how torque-4.0 generator works

 I tried to build

 Turbine/Fulcrum/Torque Security module in trunk.

 But I got following build error.

 [INFO] 
 
 [INFO] Building Fulcrum Security Torque Impl 1.1.0-SNAPSHOT
 [INFO] 
 
 [INFO]
 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @
 fulcrum-security-torque ---
 [INFO]
 [INFO] --- torque-maven-plugin:4.0:generate (torque-om) @
 fulcrum-security-torque ---
 INFO  org.apache.torque.generator.control.Controller -
 readConfiguration() : Starting to read configuration files
 INFO  
 org.apache.torque.generator.configuration.controller.Log4jLoggingAdapter
 - apply() : Setting loglevel to ERROR
 [ERROR]
 org.apache.torque.generator.source.SourceException: Error parsing XML
 source file: cvc-complex-type.3.2.2: Attribute 'peerInterface' is not
 allowed to appear in element 'table'.
 at 
 org.apache.torque.generator.source.stream.XmlSourceFormat.parse(XmlSourceFormat.java:143)
 at 
 org.apache.torque.generator.source.stream.FileSource.createRootElement(FileSource.java:134)
 at 
 org.apache.torque.generator.source.SourceImpl.getRootElement(SourceImpl.java:48)
 at 
 org.apache.torque.generator.control.Controller.processSourceInOutput(Controller.java:256)
 at 
 org.apache.torque.generator.control.Controller.processOutput(Controller.java:228)
 at 
 org.apache.torque.generator.control.Controller.processGenerationUnit(Controller.java:181)
 at 
 org.apache.torque.generator.control.Controller.run(Controller.java:111)
 at 
 org.apache.torque.generator.maven.TorqueGeneratorMojo.execute(TorqueGeneratorMojo.java:678)
 at 
 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
 at 
 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
 at 
 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
 at 
 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
 at 
 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
 at 
 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
 at 
 org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
 at 
 org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
 at org.apache.maven.cli.MavenCli.main(MavenCli.java:141

Re: 3.3 to 4.0 migration

2014-09-24 Thread Thomas Fox
(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
at 
org.apache.torque.generator.source.stream.XmlSourceFormat.parse(XmlSourceFormat.java:132)
... 28 more
[INFO] 
[INFO] Reactor Summary:
[INFO]
[INFO] Fulcrum Security Master Build . SUCCESS [2.042s]
[INFO] Fulcrum Security API .. SUCCESS [6.811s]
[INFO] Fulcrum Security Hibernate Impl ... SUCCESS [28.787s]
[INFO] Fulcrum Security Memory Impl .. SUCCESS [10.053s]
[INFO] Fulcrum Security Torque Impl .. FAILURE [0.935s]
[INFO] 
[INFO] BUILD FAILURE
[INFO] 
[INFO] Total time: 48.893s
[INFO] Finished at: Wed Sep 24 13:49:11 KST 2014
[INFO] Final Memory: 20M/49M
[INFO] 
[ERROR] Failed to execute goal
org.apache.torque:torque-maven-plugin:4.0:generate (torque-om) on
project fulcrum-security-torque: Error parsing XML source file:
cvc-complex-type.3.2.2: Attribute 'peerInterface' is not allowed to
appear in element 'table'. - [Help 1]
[ERROR]


How can I fix it ?

Thanks,

Youngho

2014-09-17 4:56 GMT+09:00 Thomas Fox thomas@seitenbau.com:
 Youngho Cho wrote:
 

 For the 4.0 generator usage,

 In my 3.3 schema xml

 I use database/baseClass like

 database name=@DATABASE_PROP_NAME@
   baseClass=com.nannet.jettiger.om.AbstractCache
  defaultJavaType=object

 and in the AbstractCache class, I put common function for all generated 
 class.

 In order to migrate to torque4, how to be a change ?

 Hi Youngho,

 As far as I found you have different options
 - set the torque.om.dbObjectDefaultBaseClass generator option
 - set the baseClass attribute on the database element in the schema
 - set the baseClass attribute on the table element in the schema

 So your old method should still work.

Hope that helps,

   Thomas

 2014-09-12 17:21 GMT+09:00 Thomas Fox thomas@seitenbau.com:
 Hello Youngho

 ...
 The Generator looks like different

 Yes it is new-written and now better extensible. But if you have not changed 
 the templates this should not bother you. If you have changed the templates, 
 you can now specifically overwrite specific templates, no need to copy the 
 whole tree.

 ...
 Is there any plan to migrate JCS from 1.3.x to 2.x for torque4 ?

 Currently there is no plan I am aware of.  But I am working on 4.1 
 currently, if you feel this would be an improvement please add a feature 
 request to the torque issue tracker.

   Thanks,

   Thomas

 - Ursprüngliche Mail -
 Von: Youngho Cho youngho1...@gmail.com
 An: Thomas Fox thomas@seitenbau.com
 CC: Apache Torque Users List torque-user@db.apache.org
 Gesendet: Freitag, 12. September 2014 10:11:15
 Betreff: Re: 3.3 to 4.0 migration

 Hello Tomas,

 Quicky read the torque4 document,
 I think I need some learing period for migration from 3.3.x to 4.x,

 The BaseObject removed,
 The Generator looks like different
 and many chaned
 I need a better understanding about torque4 before my application's
 migration start.

 At this moment, I have a question.

 Is there any plan to migrate JCS from 1.3.x to 2.x for torque4 ?

 Thanks,

 Youngho







 2014-09-09 9:23 GMT+09:00 Youngho Cho youngho1...@gmail.com:
 Hello Thomas,

 I am gathering an information for the migration at this moment.

 When I start the migration and have some specific question I will ask.


 Thanks,

 Youngho

 2014-09-08 16:21 GMT+09:00 Thomas Fox thomas@seitenbau.com:
 This is the only document i know in the official documentation.
 Do you have any specific questions?

Thomas


 - Ursprüngliche Mail -
 Von: Scott Eade sc...@eade.id.au
 An: Youngho Cho youngho1...@gmail.com
 CC: torque-user@db.apache.org
 Gesendet: Sonntag, 7. September 2014 06:26:59
 Betreff: Re: 3.3 to 4.0 migration



 On 7 Sep 2014, at 12:22 pm, Youngho Cho youngho1...@gmail.com wrote:

 Hello

 I am preparing torque 3.3 to 4.0 migration.

 I read 
 torque-4.0/documentation/orm-reference/migration-from-torque-3.html.
 But I hope to know more detail information.

 Is there any more detail document / information for migration process ?


 Thanks,

 Youngho


 -
 To unsubscribe, e-mail: torque-user-unsubscr

Re: 3.3 to 4.0 migration

2014-09-24 Thread Thomas Fox
Hello Youngho,

Thanks for the information.
Maybe they are missing other features in the generator, if they identify one 
they should raise an issue in the Torque issue tracker.

   Thanks,

  Thomas

Youngho Cho wrote:

Hello Thomas,

Thanks for the information.

Look like the generator works very well,

But the fulcrum-torque-security can not build
I think it is broken.

I will report it to the turbine community

please refer to the following Error

[INFO] 
[INFO] Building Fulcrum Security Torque Impl 1.1.0-SNAPSHOT
[INFO] 
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @
fulcrum-security-torque ---
[INFO] Deleting E:\project\fulcrum\security\torque\target
[INFO]
[INFO] --- torque-maven-plugin:4.1-SNAPSHOT:generate (torque-om) @
fulcrum-security-torque ---
INFO  org.apache.torque.generator.control.Controller -
readConfiguration() : Starting to read configuration files
INFO  org.apache.torque.generator.configuration.controller.Log4jLoggingAdapter
- apply() : Setting loglevel to ERROR
[INFO] Generation successful
[INFO]
[INFO] --- maven-remote-resources-plugin:1.4:process (default) @
fulcrum-security-torque ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
fulcrum-security-torque ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory
E:\project\fulcrum\security\torque\src\main\resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @
fulcrum-security-torque ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 169 source files to
E:\project\fulcrum\security\torque\target\classes
[INFO] -
[ERROR] COMPILATION ERROR :
[INFO] -
[ERROR] 
/E:/project/fulcrum/security/torque/src/java/org/apache/fulcrum/security/torque/turbine/TorqueTurbineGroupManagerImpl.java:[27,47]
cannot find symbol
  symbol:   class PeerManagable
  location: package org.apache.fulcrum.security.torque.peer
[ERROR] 
/E:/project/fulcrum/security/torque/src/java/org/apache/fulcrum/security/torque/turbine/TorqueTurbineGroupManagerImpl.java:[41,90]
cannot find symbol
  symbol: class PeerManagable
[ERROR] 
/E:/project/fulcrum/security/torque/src/java/org/apache/fulcrum/security/torque/turbine/TorqueTurbineRoleManagerImpl.java:[27,47]
cannot find symbol
  symbol:   class PeerManagable
  location: package org.apache.fulcrum.security.torque.peer
[ERROR] 
/E:/project/fulcrum/security/torque/src/java/org/apache/fulcrum/security/torque/turbine/TorqueTurbineRoleManagerImpl.java:[41,88]
cannot find symbol
  symbol: class PeerManagable
[ERROR] 
/E:/project/fulcrum/security/torque/src/java/org/apache/fulcrum/security/torque/turbine/TorqueTurbinePermissionManagerImpl.java:[27,47]
cannot find symbol
  symbol:   class PeerManagable
  location: package org.apache.fulcrum.security.torque.peer
[ERROR] 
/E:/project/fulcrum/security/torque/src/java/org/apache/fulcrum/security/torque/turbine/TorqueTurbinePermissionManagerImpl.java:[41,100]
cannot find symbol
  symbol: class PeerManagable
[ERROR] 
/E:/project/fulcrum/security/torque/src/java/org/apache/fulcrum/security/torque/turbine/TorqueTurbineUserManagerImpl.java:[28,47]
cannot find symbol
  symbol:   class PeerManagable
  location: package org.apache.fulcrum.security.torque.peer
[ERROR] 
/E:/project/fulcrum/security/torque/src/java/org/apache/fulcrum/security/torque/turbine/TorqueTurbineUserManagerImpl.java:[44,108]
cannot find symbol
  symbol: class PeerManagable
[ERROR] 
/E:/project/fulcrum/security/torque/src/java/org/apache/fulcrum/security/torque/turbine/TorqueTurbineUserManagerImpl.java:[172,5]
method does not override or implement a method from a supertype
[INFO] 9 errors


Thanks,

Youngho


2014-09-24 17:22 GMT+09:00 Thomas Fox thomas@seitenbau.com:

 Hi Youngho

 can you please replace the schema location

 http://db.apache.org/torque/4.0/templates/database.xsd

 by

 http://db.apache.org/torque/torque-4.0/documentation/orm-reference/database-4-0.xsd

 This has changed in trunk.

Thanks,

Thomas

 Youngho Co wrote:

 Hello Thomas,

 I checkout fresh torque and turbine/fulcrum trunk
 and build torque4 trunk successfully.

 But  when I build fulcrum security module (using torque-4.1-SNAPSHOT modules)
 I got following error.

 I am not sure it is torque-4.1 environent or not.


 Thanks,

 Youngho

 [INFO] 
 
 [INFO] Building Fulcrum Security Torque Impl 1.1.0-SNAPSHOT
 [INFO] 
 
 [INFO]
 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @
 fulcrum-security-torque ---
 [INFO]
 [INFO] --- torque-maven-plugin:4.1

Re: 3.3 to 4.0 migration

2014-09-08 Thread Thomas Fox
This is the only document i know in the official documentation.
Do you have any specific questions?

   Thomas


- Ursprüngliche Mail -
Von: Scott Eade sc...@eade.id.au
An: Youngho Cho youngho1...@gmail.com
CC: torque-user@db.apache.org
Gesendet: Sonntag, 7. September 2014 06:26:59
Betreff: Re: 3.3 to 4.0 migration



 On 7 Sep 2014, at 12:22 pm, Youngho Cho youngho1...@gmail.com wrote:
 
 Hello
 
 I am preparing torque 3.3 to 4.0 migration.
 
 I read torque-4.0/documentation/orm-reference/migration-from-torque-3.html.
 But I hope to know more detail information.
 
 Is there any more detail document / information for migration process ?
 
 
 Thanks,
 
 Youngho
 

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


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



Re: Generating schema.xml

2013-09-17 Thread Thomas Fox
 thanks, I found introduction how to generate from jdbc later on
 http://db.apache.org/torque/torque-4.0/documentation/orm-reference/
 running-the-generator.html

I also fixed the docs for the next release so that the information can also
be found on documentation/orm-reference/defining-the-schema.html
(which is where I'd expect the users to look)

 Running generator I get
 [ERROR]
 java.lang.NullPointerException
at

org.apache.torque.generator.source.jdbc.JdbcMetadataSource.createRootElement

 (JdbcMetadataSource.java:215)
at org.apache.torque.generator.source.SourceImpl.getRootElement
 (SourceImpl.java:48)
at
 org.apache.torque.generator.control.Controller.processSourceInOutput
 (Controller.java:256)
 ...

  Changed log level to debug made clear that some tables have been
 processed, and that error occures for specific table.

 Since I do not need all table available in the specified db scheme, I
 have a question how to specify a set of tables for which generation
 should be done?
 Or the generation is done always for whole scheme, that is for all
 tables defined in this scheme?

Currently, it is not possible to run the schema generation for specific
tables only.
However, I have fixed the NullPointerException in the trunk (it was thrown
when an unknown datatype was encountered)
So if you want you can check out the current trunk, build and install it
and then try again withj the 4.1-SNAPSHOT maven plugin.

Thomas

 2013/9/12 Thomas Fox thomas@seitenbau.com
 
   is there a way to generate schema.xml from existing db schema (this
woulb
   be prefered way) or from existing POJOs (entities)?
 
  Yes.
  For maven, fgenerate the schema from the database using jdbc metadata
by:
 
plugin
  groupIdorg.apache.torque/groupId
  artifactIdtorque-maven-plugin/artifactId
  version4.0/version
  executions
execution
  idgenerate-schema-from-jdbc/id
  phasegenerate-resources/phase
  goals
goalgenerate/goal
  /goals
  configuration
packagingclasspath/packaging
 
  configPackageorg.apache.torque.templates.jdbc2schema/configPackage
 
defaultOutputDirtarget/generated-schema/defaultOutputDir
defaultOutputDirUsagenone/defaultOutputDirUsage
loglevelinfo/loglevel
options
  torque.jdbc2schema.driver$
  {driver}/torque.jdbc2schema.driver
  torque.jdbc2schema.url$
  {database.url}/torque.jdbc2schema.url
  torque.jdbc2schema.user$
  {database.user}/torque.jdbc2schema.user
  torque.jdbc2schema.password$
  {database.password}/torque.jdbc2schema.password
/options
  /configuration
/execution
  /executions
/plugin
 
  Note that the generated schema is just a starting point, there is some
  information missing from jdbc metadata (e.g. foreign keys, indexes,
unique
  constraints...)
 
 Hope that helps,
 
  Thomas
 
 
  -
  To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
  For additional commands, e-mail: torque-user-h...@db.apache.org
 

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



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



RE: Generating schema.xml

2013-09-12 Thread Thomas Fox
 is there a way to generate schema.xml from existing db schema (this woulb
 be prefered way) or from existing POJOs (entities)?

Yes.
For maven, fgenerate the schema from the database using jdbc metadata by:

  plugin
groupIdorg.apache.torque/groupId
artifactIdtorque-maven-plugin/artifactId
version4.0/version
executions
  execution
idgenerate-schema-from-jdbc/id
phasegenerate-resources/phase
goals
  goalgenerate/goal
/goals
configuration
  packagingclasspath/packaging

configPackageorg.apache.torque.templates.jdbc2schema/configPackage
  defaultOutputDirtarget/generated-schema/defaultOutputDir
  defaultOutputDirUsagenone/defaultOutputDirUsage
  loglevelinfo/loglevel
  options
torque.jdbc2schema.driver$
{driver}/torque.jdbc2schema.driver
torque.jdbc2schema.url$
{database.url}/torque.jdbc2schema.url
torque.jdbc2schema.user$
{database.user}/torque.jdbc2schema.user
torque.jdbc2schema.password$
{database.password}/torque.jdbc2schema.password
  /options
/configuration
  /execution
/executions
  /plugin

Note that the generated schema is just a starting point, there is some
information missing from jdbc metadata (e.g. foreign keys, indexes, unique
constraints...)

   Hope that helps,

Thomas


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



RE: SummaryHelper not setting replacements

2013-06-12 Thread Thomas Fox
|
|Jay Bourland wrote:
 |
|
  ---|
  | An:   |
  ---|



 I'm trying to convert an old Torque site to version 4. I'm running
 into a problem with using a count() function. The code looks like this:

   Criteria crit = getCriteriaDogsWithAllTitles( titles, year );

   SummaryHelper summary = new SummaryHelper();

   summary.addAggregate( count, new Count( DogPeer.DOG_ID ) );
   ListListOrderedMapCI results = summary.summarize( crit );

 When summarize() is executed, I get a
 jdbc4.MySQLSyntaxErrorException: You have an error in your SQL
 syntax exception. The Criteria is good and works fine with a
 doSelect(). It appears that the summarize converts the Criteria to a
 string without adding in the replacements for the parameters in the
 prepared statement.

Can you please provide an example how you construct a crit which fails ?

 Also, if I take the string from the
 queryStatement and replace the '?' with values, the statement runs
 fine from an interactive MySQL session. When I compare the code in
 SummaryHelper.summarize() to BasePeerImpl.doSelect() the code to set
 the replacements is present in doSelect but not in summarize.

 What's the best way to report this?

Please file a jira issue at

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

As a workaround, you can try
   crit.addSelectColumn(new org.apache.torque.util.functions.Count
(*));
   int count = SomePeer.doSelectSingleRecord(crit, new
org.apache.torque.om.mapper.IntegerMapper());

instead of
   summary.addAggregate( count, new Count( DogPeer.DOG_ID ) );
   ListListOrderedMapCI results = summary.summarize( crit );

Thomas


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



Torque 4.0 released

2013-03-08 Thread Thomas Fox

The Torque team is pleased to announce the release of Torque 4.0.

It is available via download on
http://db.apache.org/torque/torque-4.0/download.html (please empty your
browser cache)
or via maven central under the group id org.apache.torque.

The most prominent changes with respect to 3.3 are
- The generator is now a general-purpose code generator.
- As the templates are now modular, it is easy to extend or modify the
generated code without having to replace the whole set of templates.
- A new Criteria implementation was created, with slightly changed
semantics. The old Criteria implementation was retained but deprecated.
- Prepared statements are used throughout all queries.
- Column names are now encapsulated in objects.
However, the overall look and feel of Torque 3 was maintained.

The most prominent changes with respect to 4.0-beta1 are
- Updates using custom SQL now use prepared statements.
- The documentation is now available for download.
- The documentation structure was reorganized.
- There are now specific exceptions thrown for deadlocks and constraint
violations (DeadlockException and ConstraintViolationException).
- Associated object state can now be set by a bulk operation (see generated
setAndSave methods in Peers).
- And a few bugs were fixed.

For a full list of changes, see
http://db.apache.org/torque/torque-4.0/jira-report.html

Website:
http://db.apache.org/torque/torque-4.0/index.html (please empty your
browser cache)

Thanks to everyone who made this release possible !

  The Torque Team


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



RE: missing dtd files from http://db.apache.org/torque/dtd/

2012-12-28 Thread Thomas Fox
The Torque site was switched to svnpubsub, and I forgot to migrate the dtd
files. I'll try to find time to add them today evening in the old location.

   Thanks for the heads up,

Thomas

 All dtd files are missing from: http://db.apache.org/torque/dtd/ page,
 please see cached page on google
 (http://webcache.googleusercontent.com/search?

q=cache:TLZ_8Vbpzf0J:db.apache.org/torque/dtd/+cd=2hl=enct=clnkgl=us),
 is the dtd file URL updated?
 Thanks,

 David


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



RE: Template overrides through maven pom.xml.

2012-11-23 Thread Thomas Fox
 The answer depends on which Torque maven plugin you use:
 torque-4.0-beta1 or torque-3.3 ?

For Torque 3 , set
  plugin
groupIdorg.apache.torque/groupId
artifactIdtorque-maven-plugin/artifactId
version3.3/version
configuration
  useClasspathfalse/useClasspath
...

and torque will only use the templates in src/main/torque/templates and
ignore its original templates

For torque 4, use

  plugin
groupIdorg.apache.torque/groupId
artifactIdtorque-maven-plugin/artifactId
version4.0-beta1/version
configuration
  overrideConfigDirsrc/main/torque/templates/overrideConfigDir

and Torque will use the templates in src/main/torque/templates preferred
to, but still using the original templates.

   Hope that helps,

 Thomas

  Hello All,
 
 
  I'm very noob with torque;  I'm currently using Maven 3.0.4
  with the maven2 torque plugin and I'm trying to set the equivalent
  to torque.override.dir=dir in the Maven pom.xml, I apologize
  beforehand if this topic has been visited before but I've gone
  and tried all possible solutions but none seem to work (templates
  are not overridden).
 
 
  Thank you in advance,
  -
  Luis Torres
  Systems Administrator PATH/ITS
  UC Berkeley
  lrtor...@berkeley.edu
 
 
 
 
 
 
  -
  To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
  For additional commands, e-mail: torque-user-h...@db.apache.org
 


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



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



RE: Template overrides through maven pom.xml.

2012-11-22 Thread Thomas Fox
The answer depends on which Torque maven plugin you use:
torque-4.0-beta1 or torque-3.3 ?

 Thomas

 Hello All,


 I'm very noob with torque;  I'm currently using Maven 3.0.4
 with the maven2 torque plugin and I'm trying to set the equivalent
 to torque.override.dir=dir in the Maven pom.xml, I apologize
 beforehand if this topic has been visited before but I've gone
 and tried all possible solutions but none seem to work (templates
 are not overridden).


 Thank you in advance,
 -
 Luis Torres
 Systems Administrator PATH/ITS
 UC Berkeley
 lrtor...@berkeley.edu






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



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



Torque 4.0-beta1 released

2012-09-24 Thread Thomas Fox

The Torque development team is pleased to announce the release of Torque
4.0-beta1.
The look and feel of Torque 3 was maintained. However, there are some
sunstantial changes:
- The generator is now a general-purpose code generator.
  - This means that the templates must now be specified as explicit
dependency in the generator. Check the tutorial for details.
- As the templates are now modular, it is easy to extend or modify the
generated code without having to replace the whole templates.
- A new Criteria implementation was created, with easier semantics. The old
Criteria implementation was retained but deprecated.
- The Torque runtime does not use the village library any more.
- Prepared statements are used throughout all queries.
- Column names are now encapsulated in objects.
- At least Java 1.5 is now required
- Database views are now supported out-of-the-box
- Supplying null as value for a database connection now results in an
error in Torque 4. In Torque 3, Torque automatically opened a database
connection if a connection argument was null.

Home page:
http://db.apache.org/torque/releases/torque-4.0/index.html

Migration guide:
http://db.apache.org/torque/releases/torque-4.0/migration-from-torque-3.html

Tutorial:
http://db.apache.org/torque/releases/torque-4.0/tutorial/index.html

Torque 4.0-beta1 is available via maven central under the following ids:
runtime:
groupIdorg.apache.torque/groupId
artifactIdtorque-runtime/artifactId
version4.0-beta1/version
maven plugin:
groupIdorg.apache.torque/groupId
artifactIdtorque-maven-plugin/artifactId
version4.0-beta1/version
templates:
groupIdorg.apache.torque/groupId
artifactIdtorque-templates/artifactId
version4.0-beta1/version

Alternatively, source and binary documentation are available at:
http://db.apache.org/torque/releases/torque-4.0/download.html

Changelog:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310280version=12312102

Feel free to contact the torque-user mailing lists if you have any
questions.

   The Torque development team


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



RE: foreign keys, complexDataModel, and external schemas

2012-02-29 Thread Thomas Fox
Hi Helge,

I just ran into what may be a feature or a bug... trying to find
 out which: When I define a table in schema1.xml and another two,
 including a  link table for a many-to-many relationship in
 schema2.xml, where schema2.xml includes schema1.xml as an external
 schema, torque will not generated the getter methods for the foreign
keys.

This behaviour is by design. I was not around when this decision was made
but the idea is that a external schema is references which has no
knowledge of the referencing schema.

 To illustrate, I have created a github project. As you will see,
 there are two schema files: first-schema.xml and second-schema.xml
 which includes the first. The generated base classes for tbl1 and
 tbl3 differ in that BaseTbl3 has the getter methods for the link
 table tbl_link_int (e.g. getTblLinkInts()), whereas BaseTbl1 does not.

 I think it would be a very useful feature to be able to split a
 large schema into several sub-schema files and not lose the ability
 to generate these setters! Maybe I am doing something wrong though!?

This would be a different feature. Something like import-schema /

You can create a jira issue for it. Personally I regard this as a sueful
feature so there is a good probability that it will be implemented for
Torque 4.

Cheers,

  Thomas


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



RE: get the SQL to be executed

2012-01-19 Thread Thomas Fox
Perhaps you can use the log output (with some tweaks to the log4j
configuration). However I'm not sure how and if Torque 3.3 logs the update
statements. But then again I've heard of drivers which at as a bridge
between the application and the real driver (e.g
http://www.squirrelsql.org/) and which can do the logging for you.

Torque 4 will not work because it uses prepared statements for updates,
this will not give you any sensible sql.

Thomas

 Hello all, is there a way in Torque to get the SQL that is sent to the
DB.
 I have to generate a txt file where I save queries basically INSERT
 statements of long records.
 I was thinking of create the Torque classes, populate the objects with
 data that I get from a local instance of the DB and then, instead of
 using a save command, get the SQL that would be executed and store it in
 a file.

 Alternatively I could use this:

 http://openhms.sourceforge.net/sqlbuilder/

 but has dependencies that requires GPL license and I would avoid in this
 case that kind of license.


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



Re: how to retrieve all the tables (tablemap) in the torque database

2011-10-19 Thread Thomas Fox
Can you please check whether the package org.apache.torque.linkage was
generated when you ran the generator and whether there is a $
{DatabaseMapInit}.java
 file in it. If yes, go to the class it inherits from and put a breakpoint
in the init() method and see whether it gets called.

Thanks,

   Thomas

 Hi there,

 I'm trying to retrieve all the tables in the default database specified
in
 schema.xml file. I tried:

 DatabaseMap dm =  Torque.getDatabaseMap();
 dm.initialize();
 System.out.println(dm.getTables().length);

 but only a subset of tables are returned, am I doing something wrong
here.
 Torque version is 3.3.
 Thanks in advnace!

 David


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



RE: Torque and SQL Injection

2011-08-05 Thread Thomas Fox
Torque 3.3 escapes Strings in Queries(see method
org.apache.torque.util.SqlExpression.quoteAndEscapeText(String, DB)), so
SQL injection should not be a problem.
The current Torque 4 trunk uses Prepared statements throughout, which is
probably even better.

 Thomas

Adrian Paleacu adrian.pale...@gmail.com schrieb am 05.08.2011 16:14:10:

 Von:

 Adrian Paleacu adrian.pale...@gmail.com

 An:

 torque-user@db.apache.org

 Datum:

 05.08.2011 16:14

 Betreff:

 Torque and SQL Injection

 Hi everyone,

 I'm wondering how safe is torque on sql injection attacks, I dind't fine
any
 official page on that.


 Regards,

 Adrian


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



Re: SV: Interface-Driven Design

2011-04-04 Thread Thomas Fox
 I thought about interfaces for the generated classes that have getter /
 setter for all of the properties. I need to use them in a
 multi-classloader environment. The idea was to create an OSGi like
 interface / implementation system. That means you have a JAR with the
 interfaces and a JAR with the implementations (in this case the
 generated classes from Torque).

 Torque is able to generate interface classes (if they not exist) but
 this are plain interfaces with no methods defined at all. It would be
 great if there is a way to generate full interfaces, as well for OSGi
 environments.

 Does anyone know a good way or did an extension for the generation
 process to handle generation of interfaces?

In the past, we have done a similar thing for Torque 3.3 (use non-static
DAOs as Frontend to the static Peer classes). We did rewrite the templates
to achieve this. I do not know any other way nor do I know that such
modified templates are available anywhere on the web.

As the Torque 3.3 templates are rewritten quite heavily for torque 4,
changing the templates for torque 3 would be a throwaway work I'm afraid.

However, for Torque 4 it is planned to allow a non-static version of the
peer classes, but this is not implemented yet. In the meantime, it may be
feasible to generate non-static wrappers for peer classes for torque 4 and
also generate interfaces. This would still involve template-rewriting.

I know this answer is not very satisfying but the pest I can come up with.

 Thomas


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



Antwort: Missing dtd file?

2011-03-22 Thread Thomas Fox
 I just encountered an error while using the torque maven plugin. The eror
 was that it could not find the file
 http://db.apache.org/torque/dtd/database_3_3.dtd

 I noticed that such a file does not exist but one only named database.dtd
 does, so I changed the location to that.

I redeployed the torque site yesterday. I will fix it as soon as possible.
Thanks for the notice.

 Thomas


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



Re: Missing dtd file?

2011-03-22 Thread Thomas Fox

 There are several files with explicit version number like
database_3_2.dtd
 There is also one without version number, just called database.dtd. Does
 that one belong to a specific verison?
 /Ludwig

It is the 3.x dev version at the time the web site is deployed.

By the way, the 3_3 dtd is now available again.

Thomas


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



Re: Using bit in primary key not supported?

2010-10-09 Thread Thomas Fox
In Torque 3.3 it does not work, sorry. I created a jira issue
https://issues.apache.org/jira/browse/TORQUE-151

However I created a fix for Torque 4.0, see commits at the jira issue. If
you want you can try to backport the fix to 3.3. You need to fix the
runtime and the templates.

Thomas

   You are right torque can't generate composite keys. Don't know what I
 was thinking. I have changed it to none now. But it seems torque does
 know that it can't generate composite keys becasue it generate exactly
 the same file with idMethod=native as it does when idMethod=none. Only
 difference between the generated files were the value of
 serialVersionUID. (Or rather I think that the case is that Torque don't
 try to generate a key when idMethod is native).

 But the problem remain. But note that the problem is with the
 getPrimaryKey() method which if I remember correct is used to get the
 key for an existing object, not generate a key for a new object.

 Martin


 On 10/08/2010 09:23 AM, Thomas Fischer wrote:
 In my schema.xml file I have
 
  table name=templatevalue idMethod=native
  column name=name primaryKey=true required=true size=255
  type=VARCHAR/
  column default=true name=preview primaryKey=true
required=true
  type=BIT/
  !-- Other fields removed --
  /table
  Torque can not generate composite keys automatically, so the idMethod
  attribute in the table should be set to none. Can you change this and
try
  again ?
 
  Thomas
 
 
  -
  To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
  For additional commands, e-mail: torque-user-h...@db.apache.org
 


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



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