This actually concerns NHibernate and I have posted the same question
over here, but as I haven't received a reply yet, I decided to ask here, too.
Just in case you should wonder why my Java is a little rusty.
I have some flags like this:
Code:
public static final int NOTHING = 0;
public static final int FOO = 1;
public static final int BAR = 2;
public static final int FUZZ = 4;
These flags map to several columns, FLAG_FOO, FLAG_BAR and FLAG_FUZZ.
As my database doesn't support booleans, those columns are of type nullable char(1) with 'X' meaning "true" and null meaning "false". I have implemented a UserType ("CharBooleanType") for such columns when used alone.
How can I have those three columns as one bit vector and still be able to use the columns in the WHERE part of the query?
Like "where Flag.Foo is not null" or something.
My current implementation implements UserType, so getting the flags combined into one int is not a problem, I only struggle with querying the columns.
I have read that implementing CompositeUserType instead will do the job.
But what will I have to do for my implementation to support those "char booleans?"
What should
getPropertyTypes() return?
Why are both
get/setPropertyValue and
nullSafeGet/Set methods required?
What should
isMutable return?
Unfortunately I could hardly find any information online, so any help will be highly appreciated.
/Marvin