Unable to use List in entity when using hbase

15 views
Skip to first unread message

sureshk...@gmail.com

unread,
Nov 20, 2016, 5:43:40 AM11/20/16
to kundera-discuss
Hi ,

I am using very simple entity as defined below with hbase

@Entity
public class Person
{
   @Id
    private String personId;
    private String personName;
    private int age;
    private String city;
    private String country;

   @ElementCollection
    private List<String> favcities;
}

However,  all fields above gets saved, but favcities is not getting saved, here is how my hbase scan looks like with test data

hbase(main):062:0> scan 'KunderaExamples:Person'
ROW                                  COLUMN+CELL                                                                                               
 12345                               column=Person:age, timestamp=1479636462350, value=\x00\x00\x00\x18                                        
 12345                               column=Person:city, timestamp=1479636462350, value=Bangalore                                                
 12345                               column=Person:country, timestamp=1479636462350, value=India                                               
 12345                               column=Person:personName, timestamp=1479636462350, value=Suresh 
1 row(s) in 0.0100 seconds

I tried removing   @ElementCollection,had same issue.

Maven entry is this

                <dependency>
<groupId>com.impetus.kundera.client</groupId>
<artifactId>kundera-hbase-v2</artifactId>
<version>3.6</version>
</dependency>

What am i missing here?

Thanks and Regards,
Suresh

sureshk...@gmail.com

unread,
Nov 20, 2016, 5:44:45 AM11/20/16
to kundera-discuss
I am using below code to initialise the set

     favcities = new ArrayList<>();
    favcities.add("Bangalore");
    favcities.add("Mysore");

Devender Yadav

unread,
Nov 29, 2016, 1:40:50 PM11/29/16
to kundera-discuss
Hi Suresh,

Using  List<String> is not yet supported in kundera-hbase-v2. As a workaround, you can use embeddable entity.


@Embeddable
public class FavCity
{
    @Column
    private String city;
}


And in Person Entity:


   @ElementCollection
    private List<FavCity> favcities;
Reply all
Reply to author
Forward
0 new messages