[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2492) Enable <generator> tag for non primary key columns that are autogenerated or is an identity

Steve Ebersole (JIRA) noreply at atlassian.com
Wed Mar 28 14:17:04 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_26583 ] 

Steve Ebersole commented on HHH-2492:
-------------------------------------

As I mentioned before if you do not want to fix your *broken* schema, thats fine; you can still make this work by marking the non-PK surogate value as a generated value in you mappings.  This will work as is for IDENTITY columns; for sequences you'll need to use a trigger or column-level DEFAULT definition to ge the sequence value into the column.  But I am not going to add support specifically for what you are asking in Hibernate.

http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html#mapping-generated

Look at the tests in the testsuite testing this feature for examples: http://fisheye.jboss.com/browse/Hibernate/trunk/Hibernate3/test/org/hibernate/test/generated


> Enable <generator> tag for non primary key columns that are autogenerated or is an identity
> -------------------------------------------------------------------------------------------
>
>                 Key: HHH-2492
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2492
>             Project: Hibernate3
>          Issue Type: New Feature
>    Affects Versions: 3.2.2
>         Environment: 3.2.2, Oracle 9i, SQL Server 2000
>            Reporter: Manoj Pallikkattil
>
> Currently hibenate allow <generator> tag for primary keys, i.e inside the <id> tag. It would be good if we can use the generator tag for non primary key columns also. Our current datamodel has a UUID char 32 as the primary key and ID column which is a sequence for Oracle and an Identity for SQL Server is a unique key. I could get this to work with Oracle using Parameterized User Type but I have not been able to achieve this for SQL Server since the identity column is filled on the insert. If we could use the <generator> tag inside a <property> tag this would resolve this issue.

-- 
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