Archives

Spring Jpa different object already associated

ERROR: A different object with the same identifier value was already associated with the session Solution: See if an existing ID already exist, if not persist record. If same ID found, merge with existing record

Rate this:

Read More

Spring JPA Embeddable Id example

Embeddable Entity Embeddable Id as @Id

Rate this:

Read More

Spring JPA No qualifying bean of type: javax.persistence.EntityManagerFactory

You can define two EntityManagers in one class: 1. Provide a name for your EntityManager Beans 2. Provide a persistentUnitName and make sure it is unique. As the entityManager injects by name into the transaction manager make sure you entitymanager bean name is same as your transaction manager parameter. In this case my entitytManager bean […]

Rate this:

Read More

JPA Criteria Query Examples

Get All Accounts Select * from Account where SSN=? Select * from DWLoan where aid=? and chngStatus is not null Count number of rows in Account Table SELECT id,status,created_at from transactions where status=’1′ and currency=’USD’ and appId=’123′ order by id

Rate this:

Read More

Spring Jpa Transaction Manager Junit Testing

Setup Jpa Transaction Manager Test Jpa Transaction Manager

Rate this:

Read More

Jdbc, Hibernate, Jpa, Spring Data setup with no xml

Below is a very easy way in Spring to create DataSources with no XML: 1. DataSource 1.1 Define DataSource Interface 1.2 Implement DataSource Interface 1.3 Test if DataSource is connected 2. Jdbc 2.1 Define Jdbc Configuration 2.2 Define Jdbc Service 2.3 Test Jdbc Service 3. Hibernate 3.1 Define Hibernate Configuration 3.2 Define Hibernate Service 3.3 […]

Rate this:

Read More