Prerequisites Download the following jars. 1. MySQL jar 2. Solr Data Import Handler jar Data Configuration File Create a data-config.xml file in conf folder & add following content to it. <dataConfig> <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://<host>:<port>/<database name>" user="<user>" password="<password>" batchSize="1" /> <document name="userdoc"> <entity name="userentity" query="select ID, FIRST_NAME, LAST_NAME from users"> <field column="id" name="ID"/> <field column="first_name" name="FIRST_NAME" /> <field column="last_name" name="L...
It is a simple implementation of Hibernate Sharding in java. In this we are using two databases i.e. shard1 and shard2. All data related to "India" goes to shard1 where as others go to shard2. Project Contents: File Name Use DatabaseCreator.java Used to create tables in databases named shard1 and shard2. User.java POJO class. User.hbm.xml Mapping file. Used to map POJO to database tables. hibernate0.cfg.xml Hibernate configuration file for database named shard1 hibernate1.cfg.xml Hibernate configuration file for database named shard2 IdGenerator.java Class for Id generation HibernateShardUtil.java Class for loading hiberante session factory. UserShardResolutionStrategy.java Class for implementing shard resolution strategy. UserShardSelectionStrategy.java Class for implementing shard selection strategy. Main.java Clie...
In Shallow copy all the fields are just copied from source object to destination object. If the source object is containing any field that holds a reference to another object then only the reference will be copied i.e. source and destination objects field(that particular field) will point to same memory location. Java code for Shallow Copy package shallow; class JobDescription { private String designation; public JobDescription(String designation) { this.designation = designation; } public String getDesignation() { return designation; } public void setDesignation(String designation) { this.designation = designation; } @Override public String toString() {...
Comments
Post a Comment