Issue Details (XML | Word | Printable)

Key: XDT-729
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: xdoclet-devel (Use for new issues)
Reporter: Felix Mayer
Votes: 5
Watchers: 5
Operations

If you were logged in you would be able to see more operations.
XDoclet

@hibernate.id tag class parameter not documented

Created: 02/Dec/03 03:25 PM   Updated: 15/Sep/05 08:58 AM
Component/s: Documentation, Hibernate Module
Affects Version/s: 1.2 Beta 3
Fix Version/s: 1.3

Time Tracking:
Not Specified

Environment: N/A
Issue Links:
Related issue (no dependency)
 


 Description  « Hide
Currently XDoclet does not support the Hibernate <composite-id> element. This means that it is not possible to use XDoclet for the mapping to database tables with composite primary keys. As Hibernate supports composite primary keys and they are fairly common in relational database design, it would be nice if XDcolet could support this as well.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
David M. Lloyd added a comment - 16/Apr/04 05:10 PM
Xdoclet does indeed support composite ids. You use @hibernate.id with a class="my.composite.key.Class".

As far as I can ascertain, the support has existed since 1.2 beta 3.

Felix Mayer added a comment - 29/Sep/04 04:57 PM
The XDoclet documentation still does not contain this parameter.
Should this then be a defect against the documentation?

Andrew Stevens added a comment - 02/Oct/04 08:33 AM
Reopening as a documentation bug.

Gili added a comment - 17/Oct/04 10:06 PM
Correct me if I'm wrong, but doesn't @hibernate.id class="my.composite.key.Class" correspond to "Components as Composite Identifiers" (url: http://www.hibernate.org/hib_docs/reference/en/html/components.html#components-compositeid) instead of composite-id (url: http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-compositeid)?

I'm trying to create a composite-id, made up of multiple properties found within my class. I don't want to create a "component composite ID". Is this possible with XDoclet? How does one tag those multiple properties as IDs?

Thanks,
Gili

Gili added a comment - 17/Oct/04 10:33 PM
In fact, using @hibernate.id class="blah" doesn't work at all on my end. I am using XDoclet 1.2.1.

Please upgrade the priority of this issue and make sure it is possible to create <composite-id> tags properly.

Perhaps I misunderstood the @hibernate.id syntax so please include a more thorough example of the usage in your reply.

Felix Mayer added a comment - 18/Oct/04 09:08 AM
It doesn't work for either, nothing is generated inside the <composite-id> tag. I since moved to writing the Hibernate descriptors manually.

Eric Pugh added a comment - 24/Oct/04 02:12 PM
I just tried it with CVS head and the /samples project. It properly created for the CompositeEntry the key:

   <composite-id
            name="id"
            class="test.hibernate.CompositeId"
        >
                     <key-property
                        name="foo"
                        type="java.lang.Integer"
                        column="foo"
                />

                     <key-property
                        name="bar"
                        type="long"
                        column="bar"
                />

                     <key-property
                        name="baz"
                        type="java.lang.String"
                        column="baz"
                />

                    <key-many-to-one
                        name="order"
                        class="test.hibernate.Order"
                        column="order"
                    />

        </composite-id>

I think we can close this bug...

Heiko W. Rupp added a comment - 24/Oct/04 02:23 PM
Eric,
can you comment if HEAD==Xdoclet 1.2.2?

Eric Pugh added a comment - 24/Oct/04 03:02 PM
Funny you mention this.. I posted this, was going to mark it resolved, and saw that 1.2.2 was listed as a released version.. It was CVS head as of an hour ago.

Have we released 1.2.2? I see the docs updated, and on SF the files, but no email announcment!

Heiko W. Rupp added a comment - 24/Oct/04 03:52 PM
It is not yet officially announced, as sf.net has problems with their download mirrors.
You might check the tags on the file(s). If the head revision also has xdoclet-v-1.2.2 as tag, then the fix is in 1.2.2.

Gili added a comment - 25/Oct/04 12:21 AM
Eric,

Can you please attach the sample code that generated the composite-id you mentioned? That is, what @hibernate tags did you use?

Thanks,
Gili

Eric Pugh added a comment - 25/Oct/04 05:13 AM
Look at CompositeId and CompositeIdEntry:
http://cvs.sourceforge.net/viewcvs.py/xdoclet/xdoclet/samples/src/java/test/hibernate/?only_with_tag=HEAD

However, now I am secondguessing myself, that this isn't what you want? The best way to fix this is can you edit the /samples and add a Java class with the tag? And what you expect in the HBM? And I can tackle fixing it.

Gili added a comment - 25/Oct/04 09:00 AM
Eric,

All I want to be able to do is specify a composite-id made up of multiple properties of a table. I don't want to have to specify a separate class to act as the composite entity.

Ideally I should be able to use multiple @hibernate.id tags, XDoclet will merge them all, and if there are more than one @hibernate.id tags then they turn into composite-ids.

Paul Galbraith added a comment - 15/Sep/05 08:58 AM
This should work nicely now (and is documented).