-
Notifications
You must be signed in to change notification settings - Fork 233
No Hard Annotation for Schema Required
JPA specifications allow entity classes to be created without schema definition mentioned in each class thus making it more flexible to be used across multiple persistence unit and in different schema. However, in Kundera this support was not enabled and each class was bounded to given schema definition.
Earlier 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 looked like this :
@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
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;
Define specific entity class mapping within tag explicitly in persistence.xml.
<persistence-unit name="noAnnotationAddMongo">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>com.impetus.kundera.tests.entities.PersonDetail</class>
....
</persistence-unit>
**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;
Existing entities with hardcoded @Table annotation will continue to work as previously.
- Same class can be used for persisting data over multiple data stores in different schema using Kundera.
- The entity available for a Nosql datastore can also be used with Hiberante thus preventing the changes required in existing apps using Hiberante.
- 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
-
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