Pre-requisites
Code
- ClusterJ API : ClusterJ is a high level database API that is similar in style and concept to object-relational mapping persistence frameworks such as Hibernate and JPA
- Requires below jar files
openjpa-1.2.0.jar
driver-5.1.10.jar
(This is the MySQL JDBC driver)geronimo-jta_1.1_spec-1.1.jar
geronimo-jpa_3.0_spec-1.0.jar
serp-1.13.1.jar
commons-lang-2.1.jar
commons-collections-3.2.jar
clusterj-api.jar
clusterj.jar
clusterjpa.jar
Code
import com.mysql.clusterj.annotation.Column; import com.mysql.clusterj.annotation.Index; import com.mysql.clusterj.annotation.PersistenceCapable; import com.mysql.clusterj.annotation.PrimaryKey;
//sample code
Properties props = new Properties();
//replace localhost with managment node hostname
props.put("com.mysql.clusterj.connectstring", "localhost:1186");
props.put("com.mysql.clusterj.connectstring", "localhost:1186");
//replace mydb with your database name.
props.put("com.mysql.clusterj.database", "mydb");
props.put("com.mysql.clusterj.database", "mydb");
References:
No comments:
Post a Comment