Cassandra 2.1 : User Defined Types - Achilles - Java Mapping -


how map user defined types in java using achilles java library in cassandra 2.1? particularly, implementation/example this link helpful.

 create type address (       street text,       city text,       zip int   );    create table user_profiles (       login text primary key,       first_name text,       last_name text,       email text,       addresses map<text, address>   ); 

to map user defined type in java using achilles , can use @udt annotation. in case , address bean :

@udt(name="address",keyspace = "your_keyspcae_name") class address{

@column("street") private string street;

@column("city") private string city;

@column("zip") private int zip;

//getter , setter methods

.
.
.
.
}

and main table mapping :

@table(table="user_profile",keyspace="your_keyspace_name") class userprofiles{

.
.
.
.

@column("addresses") private map addresses;

.
.
.
.

}

hope you.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -