-
Notifications
You must be signed in to change notification settings - Fork 0
No Hard Annotation for Schema Required
Kundera has enabled flexibility to add entities without specifying any hardcoded schema annotation. For further details please refer github#315
By giving hard coded schema definitions in an entity a single class could be used only for one datastore for a specific persistence unit.
A typical Entity class in Kundera :
@Entity
@Table(name = "KunderaUser", schema = "KunderaMetaDataTest@metaDataTest")
public class KunderaUser
{
@Id
@Column(name = "USER_ID")
private String userId;
In the above model ,in case of polyglot persistence if an entity has to be used for different datastores it had to be replicated with details of its schema and persistence unit mentioned again. So in order to resolve this issue and also adhere to JPA specifications making hard annotation for schema in a class is now made optional in Kundera
However, Existing entities with hardcoded @Table annotation will continue to work as previously
Optional @Table annotation :
Kundera will internally resolve schema and table name(Using kundera.keyspace property in persistence.xml), By default Entity name will be treated as table name unless it is explicitly provided.
@Entity
public class PersonDetail
{
/** The person id. */
@Id
private String personId;
/** The first name. */
@Column(name = "first_name")
private String firstName;
Entity with @Table annotation/without schema :
Kundera will internally resolve schema and table name(Using kundera.keyspace property in persistence.xml), The table name will be the one given with @Table Annotation.
@Entity
@Table(name = "person")
public class PersonDetail
{
/** The person id. */
@Id
private String personId;
/** The first name. */
@Column(name = "first_name")
private String firstName;
/** The last name. */
@Column(name = "last_name")
private String lastName;
Define entity class without any schema annotation in specific persistence-unit within class tag explicitly in persistence.xml and use same entity class to persist data in the multiple datastores.
<persistence-unit name="noAnnotationAddCassandra">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>com.impetus.kundera.tests.entities.PersonDetail</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="kundera.nodes" value="localhost" />
<property name="kundera.port" value="9160" />
<property name="kundera.keyspace" value="KunderaTests" />
....
</persistence-unit>
<persistence-unit name="noAnnotationAddMongo">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>com.impetus.kundera.tests.entities.PersonDetail</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="kundera.nodes" value="localhost" />
<property name="kundera.port" value="27017" />
<property name="kundera.keyspace" value="KunderaTests" />
<property name="kundera.dialect" value="mongodb" />
....
</persistence-unit>
- Same class can be used for persisting data over multiple data stores in different schema.
- The existing applications using Hiberante can also integrate a Nosql datastore using Kundera without re writing the entities for same data.
- It will allow easy context switching of persistence units for same entity class.
- Schema related parameters for an entity need not be replicated in every entity class.
-
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] (https://github.com/impetus-opensource/Kundera/wiki/Kundera-with--Couchdb)
- [Kundera with Elasticsearch] (https://github.com/impetus-opensource/Kundera/wiki/Kundera-with-Elasticsearch)
- [Kundera with HBase] (https://github.com/impetus-opensource/Kundera/wiki/Kundera-with-HBase)
- [Kundera with Kudu] (https://github.com/impetus-opensource/Kundera/wiki/Kundera-with-Kudu)
- [Kundera with MongoDB] (https://github.com/impetus-opensource/Kundera/wiki/Kundera-with-MongoDB)
- [Kundera with OracleNoSQL] (https://github.com/impetus-opensource/Kundera/wiki/Kundera-OracleNoSQL)
- [Kundera with Redis] (https://github.com/impetus-opensource/Kundera/wiki/Kundera-over-Redis)
- [Kundera with Spark] (https://github.com/impetus-opensource/Kundera/wiki/Kundera-with-Spark)
-
Extend Kundera
- Sample Codes and Examples
- [Blogs and Articles] (https://github.com/impetus-opensource/Kundera/wiki/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