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)
Embedded object with null values in db cause instances not to be updated [message #784079] Thu, 26 January 2012 22:13
Mark Ashworth is currently offline Mark Ashworth
Messages: 1
Registered: January 2012
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 {

    @Column(name = "contact_name")
    private String name;

    @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

[Updated on: Thu, 26 January 2012 22:20]

Report message to a moderator

Previous Topic:Retrieve storedprocedure messages using JPA
Next Topic:Composite Key Configuration using Dynamic Eclipse Link API
Goto Forum:
  


Current Time: Wed Apr 16 06:47:35 EDT 2014

Powered by FUDForum. Page generated in 0.01638 seconds