Skip to main content


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] Fri, 27 January 2012 03:13 Go to next message
Mark Ashworth is currently offline Mark AshworthFriend
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
Re: Embedded object with null values in db cause instances not to be updated [message #784457 is a reply to message #784082] Fri, 27 January 2012 15:03 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Can you show what is in the entity that is read back if you call find, and what you are trying to merge into the persistence unit? ie is the Contact null, or do the enities contain a nulled out Contact?

Best Regards,
Chris
Re: Embedded object with null values in db cause instances not to be updated [message #784460 is a reply to message #784082] Fri, 27 January 2012 15:04 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Can you show what is in the entity that is read back if you call find, and what you are trying to merge into the persistence unit? ie is the Contact null, or do the enities contain a nulled out Contact?

Best Regards,
Chris
Previous Topic:Composite Key Configuration using Dynamic Eclipse Link API
Next Topic:ReadObjectQuery with setSelectionId=null has undeterministic behavior
Goto Forum:
  


Current Time: Tue Dec 10 09:36:31 GMT 2024

Powered by FUDForum. Page generated in 0.03369 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top