-
Notifications
You must be signed in to change notification settings - Fork 233
Data Types Examples
xamry edited this page Mar 26, 2013
·
1 revision
This examples illustrates working with all data types supported by Kundera. It uses cassandra as persistence store.
@Entity
@Table(name = "STUDENT", schema = "KunderaExamples@cassandraPU")
public class Student {
// Primitive Types
@Id
@Column(name = "STUDENT_ID")
private long studentId;
@Column(name = "UNIQUE_ID")
private long uniqueId;
@Column(name = "STUDENT_NAME")
private String studentName;
@Column(name = "IS_EXCEPTIONAL")
private boolean isExceptional;
@Column(name = "AGE")
private int age;
@Column(name = "SEMESTER")
private char semester; // A,B,C,D,E,F for i to vi
@Column(name = "DIGITAL_SIGNATURE")
private byte digitalSignature;
@Column(name = "CGPA")
private short cgpa; // 1-10
@Column(name = "PERCENTAGE")
private float percentage;
@Column(name = "HEIGHT")
private double height;
// Date-time types
@Column(name = "ENROLMENT_DATE")
@Temporal(TemporalType.DATE)
private java.util.Date enrolmentDate;
@Column(name = "ENROLMENT_TIME")
@Temporal(TemporalType.TIME)
private java.util.Date enrolmentTime;
@Column(name = "JOINING_DATE_TIME")
@Temporal(TemporalType.TIMESTAMP)
private java.util.Date joiningDateAndTime;
// Wrapper types
@Column(name = "YEARS_SPENT")
private Integer yearsSpent;
@Column(name = "ROLL_NUMBER")
private Long rollNumber;
@Column(name = "MONTHLY_FEE")
private Double monthlyFee;
@Column(name = "SQL_DATE")
private java.sql.Date sqlDate;
@Column(name = "SQL_TIMESTAMP")
private java.sql.Timestamp sqlTimestamp;
@Column(name = "SQL_TIME")
private java.sql.Time sqlTime;
@Column(name = "BIG_INT")
private BigInteger bigInteger;
@Column(name = "BIG_DECIMAL")
private BigDecimal bigDecimal;
@Column(name = "CALENDAR")
private Calendar calendar;
//Constructors and getters/ setters here
}
create column family STUDENT
with comparator=AsciiType and key_validation_class=LongType
and column_metadata=[
{column_name: STUDENT_NAME, validation_class:UTF8Type, index_type: KEYS},
{column_name: AGE, validation_class:IntegerType, index_type: KEYS},
{column_name: UNIQUE_ID, validation_class:IntegerType, index_type: KEYS},
{column_name: IS_EXCEPTIONAL, validation_class:IntegerType, index_type: KEYS},
{column_name: SEMESTER, validation_class:IntegerType, index_type: KEYS},
{column_name: DIGITAL_SIGNATURE, validation_class:IntegerType, index_type: KEYS},
{column_name: CGPA, validation_class:IntegerType, index_type: KEYS},
{column_name: PERCENTAGE, validation_class:IntegerType, index_type: KEYS},
{column_name: HEIGHT, validation_class:IntegerType, index_type: KEYS},
{column_name: ENROLMENT_DATE, validation_class:IntegerType, index_type: KEYS},
{column_name: ENROLMENT_TIME, validation_class:IntegerType, index_type: KEYS},
{column_name: JOINING_DATE_TIME, validation_class:IntegerType, index_type: KEYS},
{column_name: YEARS_SPENT, validation_class:IntegerType, index_type: KEYS},
{column_name: ROLL_NUMBER, validation_class:IntegerType, index_type: KEYS},
{column_name: MONTHLY_FEE, validation_class:IntegerType, index_type: KEYS},
{column_name: SQL_DATE, validation_class:IntegerType, index_type: KEYS},
{column_name: SQL_TIMESTAMP, validation_class:IntegerType, index_type: KEYS},
{column_name: SQL_TIME, validation_class:IntegerType, index_type: KEYS},
{column_name: BIG_INT, validation_class:IntegerType, index_type: KEYS},
{column_name: BIG_DECIMAL, validation_class:IntegerType, index_type: KEYS},
{column_name: CALENDAR, validation_class:UTF8Type, index_type: KEYS}
];
-
Datastores Supported
- Releases
-
Architecture
-
Concepts
-
Getting Started in 5 minutes
-
Features
- Object Mapper
- Polyglot Persistence
- Queries Support
- JPQL (JPA Query Language)
- Native Queries
- Batch insert update
- Schema Generation
- Primary Key Auto generation
- Transaction Management
- REST Based Access
- Geospatial Persistence and Queries
- Graph Database Support
-
Composite Keys
-
No hard annotation for schema
-
Support for Mapped superclass
-
Object to NoSQL Data Mapping
-
Cassandra's User Defined Types and Indexes on Collections
-
Support for aggregation
- Scalar Queries over Cassandra
- Connection pooling using Kundera Cassandra
- Configuration
-
Kundera with Couchdb
-
Kundera with Elasticsearch
-
Kundera with HBase
-
Kundera with Kudu
-
Kundera with RethinkDB
-
Kundera with MongoDB
-
Kundera with OracleNoSQL
-
Kundera with Redis
-
Kundera with Spark
-
Extend Kundera
- Sample Codes and Examples
-
Blogs and Articles
-
Tutorials
* Kundera with Openshift
* Kundera with Play Framework
* Kundera with GWT
* Kundera with JBoss
* Kundera with Spring
-
Performance
-
Troubleshooting
-
FAQ
- Production deployments
- Feedback