[jboss-jira] [JBoss JIRA] Updated: (HIBERNATE-59) @OneToMany collection is not filled when it should when the PK is of uniqueidentifier

Tobias Bergman (JIRA) jira-events at lists.jboss.org
Tue Jun 26 03:32:23 EDT 2007


     [ http://jira.jboss.com/jira/browse/HIBERNATE-59?page=all ]

Tobias Bergman updated HIBERNATE-59:
------------------------------------

    Description: 
I have found a problem when using uniqueidentifier as PK and FK.
A collection which should have entires are empty. The same code will have a non-empty collections when tested on glassfish.


import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "A")
public class A
{
	@Id
	@Column(name = "Id")
	private String mId;

	@OneToMany(mappedBy = "mA")
	private List<B> mBList;

	//Getter and setters to the members...
}

@Entity
@Table(name = "B")
public class B
{
	@Id
	@Column(name = "Id")
	private String mId;

	@ManyToOne
	@JoinColumn(name = "AId")
	private A mA;

	//Getter and setters to the members...
}

When the db type is an uniqueidentifier the mBList list is not filled! If the db type is changed to a string the List is filled correctly.
But it works with uniqueidentifier when the entity is merged (when creating a new entity A and some B's).

  was:
I have found a problem when using uniqueidentifier as PK and FK.
A collection which should have entires are empty. The same code will have a non-empty collections when tested on glassfish.

Source code is supplied in the forum post.

       Priority: Critical  (was: Major)

> @OneToMany collection is not filled when it should when the PK is of uniqueidentifier
> -------------------------------------------------------------------------------------
>
>                 Key: HIBERNATE-59
>                 URL: http://jira.jboss.com/jira/browse/HIBERNATE-59
>             Project: Hibernate
>          Issue Type: Bug
>         Environment: Windows XP SP2
> JBoss 4.2 CR1
> SQL Server 2000
>            Reporter: Tobias Bergman
>         Assigned To: Steve Ebersole
>            Priority: Critical
>
> I have found a problem when using uniqueidentifier as PK and FK.
> A collection which should have entires are empty. The same code will have a non-empty collections when tested on glassfish.
> import javax.persistence.*;
> import java.util.List;
> @Entity
> @Table(name = "A")
> public class A
> {
> 	@Id
> 	@Column(name = "Id")
> 	private String mId;
> 	@OneToMany(mappedBy = "mA")
> 	private List<B> mBList;
> 	//Getter and setters to the members...
> }
> @Entity
> @Table(name = "B")
> public class B
> {
> 	@Id
> 	@Column(name = "Id")
> 	private String mId;
> 	@ManyToOne
> 	@JoinColumn(name = "AId")
> 	private A mA;
> 	//Getter and setters to the members...
> }
> When the db type is an uniqueidentifier the mBList list is not filled! If the db type is changed to a string the List is filled correctly.
> But it works with uniqueidentifier when the entity is merged (when creating a new entity A and some B's).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list