[hibernate-dev] Hibernate field with custom type changes, but object not marked as 'dirty' for update

Adnan Raza adnanfaizan at gmail.com
Mon Apr 29 02:59:26 EDT 2013


Hello hibernate-dev,

Currently I am facing issue with hibernate. I have a Entity class as given
below.

@Entity
@Table(name = TABLE_NAME)
@Access(AccessType.FIELD)
public class EntityClass {

//some fields

    //*@Access(AccessType.PROPERTY)*
    *@Column(name = "WA_DEFINED_TAB_INDEXES")*
*    @Type(type = SetToArrayUserType.CLASS_NAME)*
    private Set<Integer> oracleArray = new HashSet<>(10);

  @Version
    @Column(name = "versionCol" , nullable = false)
    private Integer rhpVersion = 0;


//some getters/setters


}

In case of AccessType.FIELD mapping, Hibernate doesn't mark object as dirty
and doesn't update row when we only have changes in the fields that is
mapped for custom type. If we have AccessType.PROPERTY mapping, Hibernate
do mark object dirty and make update into database.
is it bug in hibernate?
I there is an open question also
http://stackoverflow.com/questions/1268997/hibernate-field-with-custom-type-changes-but-object-not-marked-as-dirty-for-u

For the solution, either I will be forced use AccessType.PROPERTY or I have
to mix FIELD and PROPERTY approach.

Please let me know your thoughts about this.



-- 

  *With Best Regards,*
*
**       Mohd Adnan*

*       Software Developer*
       *Mobile               +91-7498194516 *


More information about the hibernate-dev mailing list