Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Embedded object with null values in db cause instances not to be updated
Embedded object with null values in db cause instances not to be updated [message #784082] Thu, 26 January 2012 22:13 Go to previous message
Mark Ashworth is currently offline Mark Ashworth
Messages: 8
Registered: March 2010
Junior Member
Hi,

The behaviour that I am experiencing with EclipseLink 2.3.1, Glassfish 3.1.2b16, SQL Server 2008 R2 is that if an embedded object has null values in the database, this prevents the update of the containing entity.

So for example, I have an embeddable class called `Contact` which I embedded into the `TrainingCourse` entity. Now when ever I perform an EntityManager.merge call on an training course instance where the contact details is null then there are no updates to the database and the log level ALL for EclipseLink does not hint at a problem.

NOTE: This worked in a previous release of EclipseLink, I think it was 2.2.x


@Embeddable
public class Contact implements Serializable {

@Size(min = 0, max = 24)
@Column(name = "contact_name")
private String name;

@Size(min = 0, max = 24)
@Column(name = "contact_telephone_no")
private String telephoneNo;





@Embedded
@AttributeOverrides({
@AttributeOverride(name = "name", column = @Column(name = "course_contact_person")),
@AttributeOverride(name = "telephoneNo", column = @Column(name = "course_contact_no"))
})
private Contact contact;




CREATE TABLE [cde].[course](
[course_id] [bigint] IDENTITY(1,1) NOT NULL,
[course_duration] [int] NOT NULL,
[course_duration_type_id] [int] NOT NULL,
[training_provider_id] [bigint] NOT NULL,
[course_accrediting_body] [varchar](64) NULL,
[course_title] [varchar](64) NOT NULL,
[course_overview] [varchar](256) NULL,
[course_contact_person] [varchar](64) NULL,
[course_contact_no] [varchar](24) NULL,
[course_internal] [bit] NULL,
[course_core] [bit] NULL,
[skill_area_id] [int] NULL,
[content_type_id] [bigint] NULL,
[course_category_id] [bigint] NULL,
[create_ts] [datetime] NULL,
[update_ts] [datetime] NULL,
[version] [int] NULL,
[archived] [bit] NULL)


Regards,
Mark P Ashworth
 
Read Message
Read Message
Read Message
Previous Topic:Composite Key Configuration using Dynamic Eclipse Link API
Next Topic:ReadObjectQuery with setSelectionId=null has undeterministic behavior
Goto Forum:
  


Current Time: Wed May 22 05:42:43 EDT 2013

Powered by FUDForum. Page generated in 0.01916 seconds