I have opened the following jira:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-289

After re-reading the documentation I found
"The special property (lowercase) id may be used to reference the unique identifier of an object. (You may also use its property name.)"


This ofcourse leads to the problem I'm having where my mapping file is
<hibernate-mapping>
<class name="Revision" table="Revision">
<id name="guid" type="java.lang.String" column="guid">
<generator class="uuid.hex"/>
</id>
<property name="id" column="id" type="java.lang.String"/>
<property name="version" column="version" type="long"/>
<property name="fromDate" column="fromDate" type="java.util.Date"/>
<property name="toDate" column="toDate" type="java.util.Date"/>
</class>
</hibernate-mapping>
as the following query will not work, id gets swapped out for guid:
from com.domain.package.Revision as rev where rev.id=? and rev.toDate is null


The reason I have this design is i'm keeping all revisions for an entity. In a legacy system I would have used a composite key of the id and version - guid is unique for all entities, while id is shared for all revisions of the same entity.

so where do I go from here, is hibernate wrong is enforcing of this "special" name, I tend to think so. Alternatively I could change from using id to something else, but I think that would suck.

Regards

Mark




------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to