-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ICompositeUserType for Multi-Column Flags
PostPosted: Sun Sep 16, 2007 2:19 pm 
Beginner
Beginner

Joined: Thu Dec 01, 2005 1:09 pm
Posts: 33
I have some flags like this:

Code:
[Flags]
enum MyEnum
{
  Nothing = 0,
  Foo = 1,
  Bar = 2,
  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 IUserType ("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 IUserType, so getting the flags converted to an instance of MyEnum is not a problem, I only struggle with querying the columns.
I have read that implementing ICompositeUserType instead will do the job.

But what will I have to do for my implementation to support those "char booleans?"
What should PropertyTypes 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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.