I had 2 Entities (one was a mapped view)
@Table(name = "BOOKING_INFO", schema = "BOOKING")
@Entity
public class BookingInfo extends AbstractBooking {
@Table(name = "BOOKING_VIEW", schema = "BOOKING")
@Entity
@Immutable
@Synchronize("BOOKING.BOOKING_INFO")
public class BookingView extends AbstractBooking {
However, a read-operation on BookingView after a write-operation on BookingInfo, did not trigger a flush, so stale data was read.
When debugging we found that our namingStrategy (SpringNamingStrategy, which extends ImprovedNamingStrategy) lowercases the table name, so we had to put this in the annotatoin:
@Synchronize("BOOKING.booking_view")
Hibernate should either apply the naming-strategies also to the values from @Synchronize or compare these case-insensitive (which could theoretically lead to too many flushes if you have a crazy database which uses tables with the same name only differentiated by casing).
|