Spring Jpa data update example for multi-tenant application
up vote
0
down vote
favorite
i am working in multi-tenant application using sprint boot and spring data. I want to do the jpa model update. where i am not using composite key model because of sequence increment limitation in composite key model.
i declared EmployeeRepository as follows. where employee_id is PK along with company_id in the employee table.
@Repository
public interface EmployeeRepository extends JpaRepository<Employee, Long> {
table Employee constraint PK_Employee primary key (Employee_ID, company_ID)
Now i am doing
Employee emp = employeeRepository.findById(empId)
employeeRepository.save(emp );
here, the save method consider employee_id in the generated sql where class. How to provide the multiple conditions in the where class during model object update.
Thanks,
Hari.
spring hibernate jpa spring-data-jpa
add a comment |
up vote
0
down vote
favorite
i am working in multi-tenant application using sprint boot and spring data. I want to do the jpa model update. where i am not using composite key model because of sequence increment limitation in composite key model.
i declared EmployeeRepository as follows. where employee_id is PK along with company_id in the employee table.
@Repository
public interface EmployeeRepository extends JpaRepository<Employee, Long> {
table Employee constraint PK_Employee primary key (Employee_ID, company_ID)
Now i am doing
Employee emp = employeeRepository.findById(empId)
employeeRepository.save(emp );
here, the save method consider employee_id in the generated sql where class. How to provide the multiple conditions in the where class during model object update.
Thanks,
Hari.
spring hibernate jpa spring-data-jpa
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
i am working in multi-tenant application using sprint boot and spring data. I want to do the jpa model update. where i am not using composite key model because of sequence increment limitation in composite key model.
i declared EmployeeRepository as follows. where employee_id is PK along with company_id in the employee table.
@Repository
public interface EmployeeRepository extends JpaRepository<Employee, Long> {
table Employee constraint PK_Employee primary key (Employee_ID, company_ID)
Now i am doing
Employee emp = employeeRepository.findById(empId)
employeeRepository.save(emp );
here, the save method consider employee_id in the generated sql where class. How to provide the multiple conditions in the where class during model object update.
Thanks,
Hari.
spring hibernate jpa spring-data-jpa
i am working in multi-tenant application using sprint boot and spring data. I want to do the jpa model update. where i am not using composite key model because of sequence increment limitation in composite key model.
i declared EmployeeRepository as follows. where employee_id is PK along with company_id in the employee table.
@Repository
public interface EmployeeRepository extends JpaRepository<Employee, Long> {
table Employee constraint PK_Employee primary key (Employee_ID, company_ID)
Now i am doing
Employee emp = employeeRepository.findById(empId)
employeeRepository.save(emp );
here, the save method consider employee_id in the generated sql where class. How to provide the multiple conditions in the where class during model object update.
Thanks,
Hari.
spring hibernate jpa spring-data-jpa
spring hibernate jpa spring-data-jpa
edited Nov 9 at 11:17
asked Nov 9 at 10:56
Hari
1617
1617
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224382%2fspring-jpa-data-update-example-for-multi-tenant-application%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown