11 Replies Latest reply on Feb 6, 2008 3:28 AM by pete007

    Problem with: seam-gen deploy

    Adrian Mitev Master

      Hi all! I've generated seam new-project and then seam generate-entities. But when i try to deploy the project to my jboss-4.0.4 GA server i got the following exception.

      compile:
       [javac] Compiling 39 source files to D:\development\SeamGenProject\SeamGenProject\exploded-archives\SeamGenProject.jar
       [javac] D:\development\SeamGenProject\SeamGenProject\src\model\com\adr\beans\BtsAttachment.java:17: illegal character: \64
       [javac] @Entity
       [javac] ^
       [javac] D:\development\SeamGenProject\SeamGenProject\src\model\com\adr\beans\BtsAttachment.java:18: illegal character: \64
       [javac] @Table(name = "bts_attachment", catalog = "bugtracker")
       [javac] ^
      


      Any idea where's the problem or what i'm doing wrong?

        • 1. Re: Problem with: seam-gen deploy
          Christian Bauer Master

          Use JDK 5.0, not 1.4.

          • 2. Re: Problem with: seam-gen deploy
            Adrian Mitev Master

            Hi Christian! I have the both 1.4.2 and 1.5 jdk but java_home pointed to 1.4.2. But now i got another problem

            
            deploy:
             [echo] Deploying project 'SeamGenProject' to JBoss
            
            init:
             [mkdir] Created dir: D:\development\SeamGenProject\SeamGenProject\exploded-archives\SeamGenProject.jar
             [mkdir] Created dir: D:\development\SeamGenProject\SeamGenProject\exploded-archives\SeamGenProject.ear
             [mkdir] Created dir: D:\development\SeamGenProject\SeamGenProject\exploded-archives\SeamGenProject.war
             [mkdir] Created dir: D:\development\SeamGenProject\SeamGenProject\dist
            
            compile:
             [javac] Compiling 39 source files to D:\development\SeamGenProject\SeamGenProject\exploded-archives\SeamGenProject.jar
             [javac] D:\development\SeamGenProject\SeamGenProject\src\action\com\adr\beans\BtsIssueHome.java:21: btsUserHome is already defined in com.adr.beans.BtsIssueHome
             [javac] BtsUserHome btsUserHome;
             [javac] ^
             [javac] D:\development\SeamGenProject\SeamGenProject\src\action\com\adr\beans\BtsIssueHome.java:23: btsReferenceDataHome is already defined in com.adr.beans.BtsIssueHome
             [javac] BtsReferenceDataHome btsReferenceDataHome;
             [javac] ^
             [javac] D:\development\SeamGenProject\SeamGenProject\src\action\com\adr\beans\BtsIssueHome.java:25: btsReferenceDataHome is already defined in com.adr.beans.BtsIssueHome
             [javac] BtsReferenceDataHome btsReferenceDataHome;
             [javac] ^
             [javac] D:\development\SeamGenProject\SeamGenProject\src\action\com\adr\beans\BtsIssueHome.java:29: btsReferenceDataHome is already defined in com.adr.beans.BtsIssueHome
             [javac] BtsReferenceDataHome btsReferenceDataHome;
             [javac] ^
             [javac] D:\development\SeamGenProject\SeamGenProject\src\action\com\adr\beans\BtsIssueHome.java:31: btsUserHome is already defined in com.adr.beans.BtsIssueHome
             [javac] BtsUserHome btsUserHome;
            


            • 3. Re: Problem with: seam-gen deploy
              Adrian Mitev Master

              This is the generated home class:


              @Name("btsIssueHome")
              public class BtsIssueHome extends EntityHome {

              @In(create = true)
              BtsReferenceDataHome btsReferenceDataHome;
              @In(create = true)
              BtsUserHome btsUserHome;
              @In(create = true)
              BtsVersionHome btsVersionHome;
              @In(create = true)
              BtsComponentHome btsComponentHome;
              @In(create = true)
              BtsUserHome btsUserHome;
              @In(create = true)
              BtsReferenceDataHome btsReferenceDataHome;
              @In(create = true)
              BtsReferenceDataHome btsReferenceDataHome;
              @In(create = true)
              BtsProjectHome btsProjectHome;
              @In(create = true)
              BtsReferenceDataHome btsReferenceDataHome;
              @In(create = true)
              BtsUserHome btsUserHome;
              @In(create = true)
              BtsReferenceDataHome btsReferenceDataHome;

              
              Looks like some objects are defined more then once


              • 4. Re: Problem with: seam-gen deploy
                Adrian Mitev Master

                This is because i have a few instances of BtsReferenceData in my entity and seam generates object equal home objects for that entities.

                • 5. Re: Problem with: seam-gen deploy
                  Adrian Mitev Master

                  I think that this is a possible bug. Should i submit an issue in the tracker?

                  • 7. Re: Problem with: seam-gen deploy
                    Newbie

                    Hello,

                    I got the same problem, but I don't understand, how to fix it correctly.
                    I have three references to the same table (entity) in one table (entity).

                    create table node ( id bigint not null auto_increment,
                     coordinates varchar(9),
                     primary key (id) ) ;
                    
                    create table routing ( id bigint not null auto_increment,
                     start_node_id bigint,
                     end_node_id bigint,
                     next_node_id bigint,
                     foreign key (start_node_id) references node(id),
                     foreign key (end_node_id) references node(id),
                     foreign key (next_node_id) references node(id),
                     primary key (id) ) ;


                    When typing seam explode I get the following error message:

                    [javac] Compiling 7 source files to ws\p\exploded-archives\h.jar
                    [javac] ws\p\src\action\m\a\RoutingHome.java:14: nodeHome is already defined in m.a.RoutingHome
                    [javac] NodeHome nodeHome;
                    [javac] ^
                    [javac] ws\p\src\action\m\a\RoutingHome.java:16: nodeHome is already defined in m.a.RoutingHome
                    [javac] NodeHome nodeHome;
                    [javac] ^
                    [javac] 2 errors


                    Following the link above, there are many files with patches. Are the patches only for 2 equal references or can I use them too? Which patch-file should I choose and how can I apply it (to which files)?

                    It would be nice, if someone could give me a short explanation, how to solve my problem.

                    Thank you in advance, Peter

                    • 8. Re: Problem with: seam-gen deploy
                      Pete Muir Master

                      Just correct the generated code.

                      • 9. Re: Problem with: seam-gen deploy
                        Newbie

                         

                        "pete.muir@jboss.org" wrote:
                        Just correct the generated code.

                        Okay, thank you for the hint. I already tried to correct it with several approaches, but didn't find the correct.

                        The first one, just to delete the two extra references, which is obviously false, leads to Routings which always have 3 pointers to the same Node.

                        Second one was to rename the references to nodeHome1, nodeHome2, nodeHome3, change the names in the wire()-method.
                        Compilation worked, deployment also, but when selecting a routing or creating a new one, I always get an exception saying:
                        "@In attribute requires non-null value: routingHome.nodeHome1"

                        Changing the names in the view components also didn't help.

                        Can you or someone else please tell me, which files I have to edit or where I can get an explanation, what is going wrong?

                        Thank you so far, Peter



                        • 10. Re: Problem with: seam-gen deploy
                          Pierre Raoul Novice

                           

                          "@In attribute requires non-null value: routingHome.nodeHome1"
                          


                          You need to declare nodeHome1, nodeHome2, nodeHome3 ... as seam components in a components.xml file.

                          See the patch "doublon" for JBSEAM-994.

                          • 11. Re: Problem with: seam-gen deploy
                            Newbie

                            Okay, thank you, I fixed the problem by a nasty workaround, but I will take a look at it when I find some time and report if I succeeded.

                            NASTY WORKAROUND:
                            - create three SQL-tables nodex, nodey, nodez
                            - change the foreignkey constraints to point to this tables
                            - run seam-gen
                            - change foreign keys to point to original intended table node
                            - change annotated tablename to "node" in classes Nodex, Nodey, Nodez

                            I know, that this isn't a good solution because the Cache is filled with three instances for every database-row, and you can get inconsistencies when editing the Nodexzy-classes, but I only use them for assigning the links between routings and nodes, so only the routings get changed.