[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5675) Using compound primary key throws SQLException
Ralf Pöhlmann (JIRA)
noreply at atlassian.com
Tue Oct 19 04:20:48 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5675?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ralf Pöhlmann updated HHH-5675:
-------------------------------
Attachment: stacktrace.txt
Stack Trace
> Using compound primary key throws SQLException
> ----------------------------------------------
>
> Key: HHH-5675
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5675
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.5.0-Final, 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.6.0.Beta1, 3.6.0.Beta2, 3.5.5, 3.6.0.Beta3, 3.6.0.Beta4, 3.5.6, 3.6.0.CR1, 3.6.0.CR2, 3.6.0
> Environment: Hibernate 3.6.0, MySql
> Reporter: Ralf Pöhlmann
> Priority: Critical
> Attachments: stacktrace.txt
>
>
> Using compound primary keys via @IdClass causes an exception when calling persist:
> Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [de.methodpark.stages.model.UserAssignment]
> at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1214)
> at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1147)
> at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1153)
> at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:678)
> at com.sun.enterprise.container.common.impl.EntityManagerWrapper.persist(EntityManagerWrapper.java:258)
> Same code works when switching JPA provider to EclipseLink.
> @Entity
> @Table(name = "user_assignment")
> @IdClass(value = UserAssignmentId.class)
> public class UserAssignment implements Serializable {
> @Id
> private Long userId;
> @Id
> private Long elementId;
> @ManyToOne(fetch = FetchType.LAZY, optional = false)
> @JoinColumn(name = "element_id", referencedColumnName = "id")
> private Element element;
> @ManyToOne(fetch = FetchType.LAZY, optional = false)
> @JoinColumn(name = "user_id", referencedColumnName = "id")
> private User user;
> }
> public class UserAssignmentId implements Serializable {
> public UserAssignmentId() { }
> @Column(name = "user_id", insertable = false, updatable = false)
> public Long userId;
> @Column(name = "element_id", insertable = false, updatable = false)
> public Long elementId;
> }
--
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