Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Issues List »

[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4009) idbag
collection-id native /
identity fails on sql server (but works on oracle)

Anupam M (JIRA)

2009-07-06

Replies: Find Java Web Hosting

Author LoginPost Reply

  [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33542#action_33542 ]

dominic roesti commented on HHH-4009:
-------------------------------------

i updated to JBoss 4.3.0.GA_CP05 including hibernate3.jar with version: Hibernate-Version: 3.2.4.sp1.cp08
i am still having the same trouble...

> idbag collection-id native / identity fails on sql server (but works on oracle)
> -------------------------------------------------------------------------------
>
>           Key: HHH-4009
>           URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4009
>         Project: Hibernate Core
>       Issue Type: Bug
>   Affects Versions: 3.2.4
>      Environment: - jboss 4.3.0_GA coming with hibernate 3.2.4
> - java jdk 1.5.0_18
> - windows server 2008 E SP2
> - microsoft sqljdbc 2.0 driver
> - microsoft sql server 2008 E
>        Reporter: dominic roesti
>        Assignee: Gail Badner
>
> related forum post:
> https://forum.hibernate.org/viewtopic.php?f=1&t=998004&start=0
> i'm trying use native id generation to enable my hibernate / java application for cross platform usage, it should run with oracle 10g (sequence) as well as with microsoft sql server 2008 (identity)
> i'm having a class "RoutingTable" with class "Route" as composite element, configured as follows:
> /**
>    * @hibernate.collection-id generator-class = "native" type =
>    * "java.lang.Long" column = "ID"
>    * @hibernate.composite-element class = "com.rixxo.mbsp.model.routing.Route"
>    *
>    * @hibernate.generator-param
>    *  name = "sequence"
>    *  value = "sq_id_mbsp_route"
>    *
>    * @hibernate.idbag lazy = "false" table = "MBSP_ROUTE" order-by = "POSITION
>    * asc"
>    * @hibernate.key column = "ROUTING_TABLE_ID"
>    */
>   public List<Route> getRoutes() {
>      return routes;
>   }
>   public void setRoutes(List<Route> routes) {
>      this.routes = routes;
>   }
> on sql server, when saving the RoutingTable with new Routes on, this causes a classcast exception:
> Code:
> 2009-07-02 10:18:26,369 [http-8443-3] INFO STDOUT - Hibernate: insert into MBSP_ROUTE (ROUTING_TABLE_ID, ID, OPERATOR_ID, CHANNEL_ID, POSITION) values (?, ?, ?, ?, ?)
> 2009-07-02 10:18:26,370 [http-8443-3] INFO LongType - could not bind value 'POST_INSERT_INDICATOR' to parameter: 2; org.hibernate.id.IdentifierGeneratorFactory$2
> 2009-07-02 10:18:26,371 [http-8443-3] WARN arjLoggerI18N - [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.beforeCompletion - failed for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@(protected)
> java.lang.ClassCastException: org.hibernate.id.IdentifierGeneratorFactory$2
>   at org.hibernate.type.LongType.set (LongType.java:42)
>   at org.hibernate.type.NullableType.nullSafeSet (NullableType.java:136)
>   at org.hibernate.type.NullableType.nullSafeSet (NullableType.java:116)
>   at org.hibernate.persister.collection.AbstractCollectionPersister.writeIdentifier (AbstractCollectionPersister.java:807)
>   at org.hibernate.persister.collection.AbstractCollectionPersister.insertRows (AbstractCollectionPersister.java:1359)
>   at org.hibernate.action.CollectionUpdateAction.execute (CollectionUpdateAction.java:56)
> i tried "native" as well as "identity" with the same result.
> there are multiple problems:
> 1) hibernate seems to try to insert a value into an identity field (ID)
> 2) the POST_INSERT_INDICATOR value cant be bound

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

   
_______________________________________________
hibernate-issues mailing list
hibernate-issues@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-issues
©2008 gg3721.com - Jax Systems, LLC, U.S.A.