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 "Nicolas Le Griel (JIRA)" <ji...@apache.org> on 2006/09/17 13:45:23 UTC

[jira] Commented: (TORQUE-55) Generated OM compilation fails when table has 2 foreign keys to another table (and generateBeans=true)

    [ http://issues.apache.org/jira/browse/TORQUE-55?page=comments#action_12435311 ] 
            
Nicolas Le Griel commented on TORQUE-55:
----------------------------------------

Bug was already fixed by issue TORQUE-21. The correction will be available in next release of Torque.

If you quickly need this correction and if you do not want to use Torque development version  you can apply patch provided in issue TORQUE-21. To do this :
 1. Extract file om/bean/ObjectBeanMethods.vm from torque-gen-templates-3.2.jar (if you use Maven it is in your Maven repository)
 2. Apply patch ObjectBeanMethods.vm.patch attached with issue TORQUE-21
 3. Put new version of file om/bean/ObjectBeanMethods.vm in torque-gen-templates-3.2.jar
 4. Update your schema file or set property torque.runOnlyOnSchemaChange to false
 5. Regenerate your OM code

OM generated code should compile.


> Generated OM compilation fails when table has 2 foreign keys to another table (and generateBeans=true)
> ------------------------------------------------------------------------------------------------------
>
>                 Key: TORQUE-55
>                 URL: http://issues.apache.org/jira/browse/TORQUE-55
>             Project: Torque
>          Issue Type: Bug
>          Components: Generator
>    Affects Versions: 3.2
>         Environment: JDK 1.5, Torque 3.2
>            Reporter: Declan Shanaghy
>         Attachments: project-schema.xml
>
>
> Given the following object model in a project where generateBeans=true 
> BOOK
> -------------------------
> book_id :  int
> author_id : int (FK)
> coauthor_id : int (FK)
> AUTHOR
> ------------------------
> author_id : int
> name : varchar(255)
> Compilation of the generated code fails with error messages shown below
> C:\Documents and Settings\Declan\bookstore\src\java\com\kazmier\om\BaseAuthor.java:1123: cannot find symbol
> symbol  : method addBookFromBean(com.kazmier.om.Book)
> location: class com.kazmier.om.Author
>                     result.addBookFromBean(related);
>                           ^
> C:\Documents and Settings\Declan\bookstore\src\java\com\kazmier\om\BaseAuthor.java:1137: cannot find symbol
> symbol  : method addBookFromBean(com.kazmier.om.Book)
> location: class com.kazmier.om.Author
>                     result.addBookFromBean(related);
> The solution is to change lines 1123 & 1137 from
>                     result.addBookFromBean(related);
>                     result.addBookFromBean(related);
> to
>                     result.addBookRelatedByAuthorIdFromBean(related);
>                     result.addBookRelatedByCoAuthorIdFromBean(related);

-- 
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: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org