christian wrote:
There is half a chapter about UserTypes in HiA...
Yah, I found that, but I wasn't sure if that's the implementation you were pointing to because I don't think it's going to work for me.
As I understand it, if I go down the custom type road, I'll end up with an object
foo which contains a customer type
metaInfo. I can then reference the meta fields via
foo.metaInfo.createdOn
Right now though, I have lots of code in existence which relies on being able to do
foo.createdOn
So by going to a custom type I'm changing the access path, am I not?
Likewise, can I even use a custom type if I want to universally map a collection as part of the type? This whole thing started this morning when we decided to add an attachments set to each and every class in the model. So my metadata atm contains:
createdOn -- timestamp
createdBy -- user
lastUpdatedOn -- timestamp
lastUpdatedBy - user
attachments -- <set>
Looking through the custom type API it seems like I can whip up a metaInfo for the first four e.g.
public String[] getPropertyNames() {
return new String[] {"lastUpdatedOn", "lastUpdatedBy", "createdOn", "createdBy"}
}
public String[] getPropertyNames() {
return new String[] {Hibernate.TIMESTAMP, ?Hibernate.CLASS?, Hibernate.TIMESTAMP, ?Hibernate.CLASS?,}
}
How do I map a *set* though? There is no Hibernate.SET, and there's the additional issue that you need a lot more information to define a set than a scalar.