EntityBinder: Incorrect WARN message about dynamicUpdate ("Entity used on a non root
entity: ignored for...")
-------------------------------------------------------------------------------------------------------------
Key: HCANN-30
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HCANN-30
Project: Hibernate Commons Annotations
Issue Type: Bug
Reporter: Shahaf Abileah
Priority: Minor
This my first bug so please excuse any mistakes I make in filing it, and help me correct
them.
I'm using PostgreSQL. I have a bunch of domain objects. Some of them are small class
hierarchies. I chose to map each class hierarchy to a single table using a discriminator
column. Here's one example where I have a base class (Note) and a subclass
(TaskNote)...
@Entity
@org.hibernate.annotations.Entity(dynamicUpdate = true)
@Table(name = "notes")
@SequenceGenerator(name = "notes_note_id_seq", sequenceName =
"notes_note_id_seq", allocationSize = 1)
@Proxy(lazy = true)
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@SQLDelete(sql="update notes set removed = true where note_id = ?")
@DiscriminatorColumn(
name=Note.noteTypeColumnName,
discriminatorType=DiscriminatorType.INTEGER
)
public abstract class Note implements Persistable {
...
}
@Entity
@org.hibernate.annotations.Entity(dynamicUpdate = true)
@Proxy(lazy = true)
@DiscriminatorValue("1")
public class TaskNote extends Note {
...
}
Notice that I added the following annotation to both:
@org.hibernate.annotations.Entity(dynamicUpdate = true)
I did this because I want to keep my updates lean.
After adding this annotation I started seeing warnings in my log:
2010-11-01 10:03:22,210 WARN org.hibernate.cfg.annotations.EntityBinder
@org.hibernate.annotations.Entity used on a non root entity: ignored for
redfin.core.domain.TaskNote
I spent some time experimenting with this annotation to understand how it works with class
hierarchies. I discovered that:
* If I put the annotation on the child class and not on the parent class, then I get the
WARN but dynamicUpdate still works
* If I put the annotation on the parent class and not the child class, then the WARN goes
away but dynamicUpdate does not work
* If I put the annotation on both, then the WARN is there and dynamicUpdate works
To me this implies that the WARN is incorrect. Do you agree?
I believe this is the code that is generating the message:
http://www.docjar.com/html/api/org/hibernate/cfg/annotations/EntityBinder...
Here are the particular versions of the various hibernate libraries that I'm using:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>3.0.0.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.7.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>antlr</artifactId>
<version>2.7.5H3</version>
</dependency>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira