Problem
I found out that hibernate's batching does not work for the following two classes while calling StatelessSession#insert(). (i.e. Prepared statements have been created for each call).
Parent Entity
@Entity
@Table(name = "950_ATC_LOG")
@DiscriminatorColumn(name = "TYPE", length = 1)
@DiscriminatorValue("C")
public class AtcLog {
@Id
@Column(name = "ATC_LOG_ID")
private long id;
// other memebers here...
}
Child Entity
@Entity
@DiscriminatorValue("A")
public class AllocationLog extends AtcLog {
// some members here
}
But after I changed the entities to the following, hibernate started to use batching as expected :
Parent Entity - NEW
@MappedSuperclass
public abstract class AbstractLog {
@Id
@Column(name = "ATC_LOG_ID")
private long id;
// some members here
}
Child Entity - NEW
@Entity
@Table(name = "950_ATC_LOG")
public class AtcLog extends AbstractLog {
@Column(name = "TYPE", length = 1, nullable = false)
private char type;
// some members here
}
Question
Is hibernate batching disabled for single table inheritance? The documentation only says that it shall be disabled with "identity identifier generator" but I set the ids explicitly. I did not find any other reference to such problem.