You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Robert Dietrick <ro...@nokia.com> on 2005/09/29 03:49:47 UTC

referencing foreign keys in other packages

My Torque schema definition specifies tables with foreign keys which 
span Java packages, and I have Bean generation turned on.  By default, 
this causes Torque to generate Java code which doesn't compile due to a 
number of issues:

1. In each bean class with a foreign key constraint that spans packages, 
the generated import statements for the Bean classes in the foreign 
package are assumed to be in the local package, and therefore reference 
non-existent classes.
2. Classes with cross-package foreign keys attempt to call the methods 
create[ClassName]([BeanClassName]) and getBean(IdentityMap) (which have 
default package-level access) from a different package.

I'm getting around issue #1 by way of an ant <replace> task which fixes 
the code.

For issue #2, I've modified the template files that the generator uses 
to make the methods create${table.JavaName}(${beanClassName}) and 
getBean(IdentityMap) public.  I'm just wondering if anyone forsees a 
real security concern with this change?


-- 
Robert Dietrick


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