Thanks a lot for taking the time to tell the whole novel here Just let me give you my last thoughts here, no need to reply: 1) I think the main issue is that I'm trying to stick to JPA - hence the AttributeConveter - without implementing Hibernate specific code - thus no JavaTyepDescriptor and the log message. This way I'd be stuck with either FallbackJavaTypeDescriptor - which works if you remember to implement equals(..) correctly - or SerializableTypeDescriptor. To me the latter seems at least as undesirable as doing the conversion implemented by AttributeConveter. My reasoning simply comes from dirty-checking, which is where I came across this whole stuff in the first place. I'd simply argue that if the serialized value written to DB remains the same it shouldn't be considered dirty and thus trigger a noop-update - and I assume you'd agree with me on this. Using JavaTypeDescriptor to check for changes and AttributeConveter to write them will always be prone to inconsistencies. Using AttributeConveter first to check for updates would eliminate this inconsistencies but potentially add some performance burden. I obviously agree with that. Don't get me wrong, I don't recommend changing the default for 5.x here. It's just something I thought I'd mention since you talked about a rewrite anyway. 2) I agree with you. However, since FallbackJavaTypeDescriptor relies on equals(..) I'd scream at the user's face if it isn't implemented at all, i.e. the Object.class.equals(cls.getMethod("equals", Object.class).getDeclaringClass())) mentioned above 3) That was mostly an idea fired from the hip. Thus the "Bonus" at the beginning. I was looking at the 5.1 branch though which doesn't have
HHH-10714 Closed implemented. Anyway, I was thinking @javax.annotation.concurrent.Immutable (JSR 305) not @org.hibernate.annotations.Immutable though. So not an immutable property but a class that's marked as immutable. I see this is implemented know with @org.hibernate.annotations.Immutable. But anyway, it was very of you to take the time to explain things so thoroughly. Not every OSS project lead acts like this. Keep it up! |