[hibernate-issues] [Hibernate-JIRA] Created: (HBX-1061) hbm2java illegal code in @columns for one-to-one constrained=true relationship.

Rodolfo Federico Gamarra (JIRA) noreply at atlassian.com
Wed May 28 13:19:33 EDT 2008


hbm2java illegal code in @columns for one-to-one constrained=true relationship.
-------------------------------------------------------------------------------

                 Key: HBX-1061
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1061
             Project: Hibernate Tools
          Issue Type: Bug
          Components: hbm2java
    Affects Versions: 3.2.beta11
         Environment: hibernate-3.2.6.ga
            Reporter: Rodolfo Federico Gamarra
            Priority: Minor
         Attachments: hibtest.zip

The generated java code is illegal in 

    @Columns(  } )
    public Principal getPrincipal() {
        return this.principal;
    }

Note the content of the annotation. The asociated Ant-Task runs succesfully.

There are two classes (Principal and Satellite) with shared primary keys. The second one has a "constrained=true" one-to-one relationship with the first, and a foreign key generator pointing to the same first entity. There are also some simple properties in both of them.

If, instead, I try to generate the dll statements, they're generated correctly:

[hibernatetool] create table Principal (id int8 not null, propA varchar(255), propB int4, primary key (id));
[hibernatetool] create table Satellite (principal_id int8 not null, propC int4, primary key (principal_id));
[hibernatetool] alter table Satellite add constraint FK1952E91B3558E23F foreign key (principal_id) references Principal;
[hibernatetool] create sequence hibernate_sequence;

Satellite has a FK to Principal's PK, and that same FK is Satellite's PK.

I attach an example project (without jars), with the sources, build files and the generated code in "gen" directory. The Eclipse launch configuration (.xml.launch) runs the Ant-Task configured by "generate-classes.xml". 

Thanks.

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

        



More information about the hibernate-issues mailing list