Agenda:
1. Creating JPA project and generating entities.
2. Configuring persistence properties and JPA project
3. Testing the JPA project
1. Creating JPA project and generating entities.
2. Configuring persistence properties and JPA project
3. Testing the JPA project
4. Update database when entity changed.
5. Setting up load balance database connection.
6. Setting Cache Coordination in Eclipselink
5. Setting up load balance database connection.
6. Setting Cache Coordination in Eclipselink
It is always changes on database tables' fields during development.
For normal approach, we probably update the database schema first and follow by the entity (both are manual process).
Now, there could be alternative by JPA provider (either Hibernate or EclipseLink).
When the JPA provider detected change(s) on entities, it will update database schema to compliance with the working copy of entities.
What we need to do is only configure to JPA provider in persistence.xml
Steps:
1. add the following line to persistence.xml if Hibernate being used.
<property name="hibernate.hbm2ddl.auto" value="update" />
add the following line to persistence.xml if EclipseLink being used
<property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
Output:
If Hibernate being used, when updating database schema, the console would looks similar like below.
If EclipseLink being used, when updating database schema, the console would looks similar like below.
PREV Testing the JPA project |
Done!!
ReplyDeleteThis blog is so nice to me. I will keep on coming here again and again. Visit my link as well.
Hibernate Training in Chennai
Spring and Hibernate Training
Hibernate Training in Anna Nagar
Spring Training in Chennai
Spring course in Chennai
soft skills training in chennai
core java training in chennai
Hibernate Training in T Nagar