HOM can only convert basic java types "out of the box", so when you
use a new type, like Room and Address in your example, you need to
provide a converter.
the exeption is when a custom type is used in a java Collection. HOM
uses java serialization.
i'm looking at the other issues with persisting a list.
do the HOM unit tests work for you?
please let me know, because i've been wanting a reason to remove the
javax.persistence references ;)
On Thu, Oct 20, 2011 at 11:16 AM, B. Todd Burruss <bto...@gmail.com> wrote:
i believe what is happening in your case is that since you are using
javax.persistence.Column, when saving, HOM is discovering that the
ArrayList is Serializable and persisting the object in a single
column. However, when loading, HOM cannot handle the "List" type
because it isn't Serializable. This is a bug, but you still should
use HOM's @Column and things will work properly.
I will make a note of the Serializable bug, thx!
Thanks
On Oct 25, 10:38 am, atig <anuj.hoo...@gmail.com> wrote:
> I see. I know you don't have an ETA, but is there a plan to add
> support for this?
>
> On Oct 24, 9:36 pm, "B. Todd Burruss" <bto...@gmail.com> wrote:
>
> > can't do that at the moment. don't have an ETA at the moment. what
> > you can do with the latest push of code (must compile from master) is
> > specify a converter for the entire collection.
>
> > On Mon, Oct 24, 2011 at 10:46 AM, atig <anuj.hoo...@gmail.com> wrote:
> > > Just wondering how to specfiy a custom converter for Drawer in my
> > > example above
> > > So if I have something like
>
> > >HOM's@Column
> > > List<Drawer> drawerList;
>
> > > I would like to specify a custom converter for Drawer. How do I do
> > > that?
>
> > > On Oct 21, 12:05 pm, atig <anuj.hoo...@gmail.com> wrote:
> > >> Hmm cool that did work and yes, I forgot to mention, the arraylist
> > >> wasn't being saved in different columns.
> > >> Changing the annotation fixes it.
>
> > >> Thanks for reporting the bug, feel free to link to this thread if you
> > >> like.
>
> > >> On Oct 20, 10:35 pm, "B. Todd Burruss" <bto...@gmail.com> wrote:
>
> > >> > if you don't annotate withHOM's@Column, it will not call
> > >> > ColumnParser.processColumnCustomAnnotation, and therefore not note the
> > >> > property's type of Collection.
>
> > >> > i believe what is happening in your case is that since you are using
> > >> > javax.persistence.Column, when saving,HOMis discovering that the
> > >> > ArrayList is Serializable and persisting the object in a single
> > >> > column. However, when loading,HOMcannot handle the "List" type
> > >> > because it isn't Serializable. This is a bug, but you still should
> > >> > useHOM's@Column and things will work properly.
> > >> > >> >HOMcan only convert basic java types "out of the box", so when you
> > >> > >> > use a new type, like Room and Address in your example, you need to
> > >> > >> > provide a converter.
>
> > >> > >> > the exeption is when a custom type is used in a java Collection. HOM
> > >> > >> > uses java serialization.
>
> > >> > >> > On Wed, Oct 19, 2011 at 4:20 PM, atig <anuj.hoo...@gmail.com> wrote:
> > >> > >> >> Great! Thanks for the link, I have been looking at the wiki on Git
> > >> > >> >> hub. These docs are more explanatory.
> > >> > >> >> It does answer some of the questions for me. I do have a few more.
>
> > >> > >> >> 1. How do you useHOMfor compound objects?
>
> > >> > >> >> Class House {
> > >> > >> >> Room room;
> > >> > >> >> Address address;
> > >> > >> >> }
>
> > >> > >> >> Class Room {
> > >> > >> >> ...
> > >> > >> >> }
>
> > >> > >> >> Class Address {
> > >> > >> >> ...
> > >> > >> >> }
>
> > >> > >> >> Will this be treated as custom property and thus I would use a custom
> > >> > >> >> converter?
>
> > >> > >> >> 2. How are Object Arrays mapped?
>
> > >> > >> >> Class House {
> > >> > >> >> Room[] rooms;
> > >> > >> >> }
>
> > >> > >> >> Thanks for your reply.
>
> > >> > >> >> On Oct 19, 7:04 pm, Patricio Echagüe <patric...@gmail.com> wrote:
> > >> > >> >>> did you check outHOMdocs inhttp://hector-client.org?
>
> > >> > >> >>> On Wed, Oct 19, 2011 at 7:20 AM, atig <anuj.hoo...@gmail.com> wrote:
> > >> > >> >>> > Hello new to usingHOM/ Hector and Cassandra. I have a few very basic
> > >> > >> >>> > questions below. Would it be possible to useHOMfor the following
> > >> > >> >>> > Pojos.
>
> > >> > >> >>> > Class House {
> > >> > >> >>> > int id;
> > >> > >> >>> > List<Room> rooms;
> > >> > >> >>> > }
>
> > >> > >> >>> > Class Room {
> > >> > >> >>> > int id;
> > >> > >> >>> > String name;
> > >> > >> >>> > List<Furniture> furniture;
> > >> > >> >>> > }
>
> > >> > >> >>> > Class Furniture {
> > >> > >> >>> > int id;
> > >> > >> >>> > String material;
> > >> > >> >>> > }
>
> > >> > >> >>> > Class Table extends Furniture {
> > >> > >> >>> > String shape;
> > >> > >> >>> > }
>
> > >> > >> >>> > 1. Is something like above posisble? Or is that a bad idea?
> > >> > >> >>> > 2. How deep can the nesting of objects be?
> > >> > >> >>> > 3. Is there a document which explains the mapping of different
> > >> > >> >>> > datatypes and collection?
> > >> > >> >>> > for eg: Room[] rooms; How would you useHOMon such an array.
> > >> > >> >>> > 4. What is the best practice when usingHOM? Design the cassandra