[jboss-jira] [JBoss JIRA] (HIBERNATE-172) Hibernate generates no needed update statement

nimo stephan (Jira) issues at jboss.org
Tue Mar 31 05:52:21 EDT 2020


nimo stephan created HIBERNATE-172:
--------------------------------------

             Summary: Hibernate generates no needed update statement
                 Key: HIBERNATE-172
                 URL: https://issues.redhat.com/browse/HIBERNATE-172
             Project: Hibernate Integration
          Issue Type: Bug
            Reporter: nimo stephan
            Assignee: Steve Ebersole


I have an orderinary entity with this property:


{code:java}
    @Entity
    @DynamicUpdate
    public class User {
    
        @Convert(converter = TaskConverter.class)
        private Map<Task, Type> tasks;
    
    ..
    }
{code}


where the `Task` is an Enum-class and the `Type` is another Enum-class. The converter converts the tasks to a string and back. All works, however, Hibernate generates an additional update statement for the `tasks` when I create a new `User`-Instance or update other entity properties of the `User`-instance:
   

{code:java}
    // this update statement is always created altough "tasks" was not changed
    update User set tasks=? where id_user=?
{code}


It behaves as if `tasks` would be an @ElementCollection where the tasks is always recreated on create or update of its parent entity `User`. However, I annotated it with `@Convert`. 

Hibernate should not generate an update statement if `tasks` is left unchanged.



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list