cancel
Showing results for 
Search instead for 
Did you mean: 

ServiceLayer Direct Implementation

Former Member
0 Kudos

Hi Experts,

We are working on updating the huge amount of records into Hybris database from the third party rest services for this , we would like to use ServiceLayer Direct for faster updation, but we could not find proper documentation for how to implement this business logic. From wiki i could find only a link but it is saying limitation and approach, but there is no usage documentation , could some one please help me.

Accepted Solutions (0)

Answers (3)

Answers (3)

Marko_salonen
Contributor
0 Kudos

Exactly, it all happens down under in the platform. When you call modelService.save() hybris will automatically use SLD logic to store things.

Former Member
0 Kudos

Hi Gopi,

When you update any records in Hybris data base , usually any data persistence should happen in DAO layer. and which is Hybris design pattern and as Marko said you do not implement any thing special when you updating or modifying records in database. Your service layer trigger , Facade layer , and then DAO layer where you can implement all you data base flexible search queries

Thanks

Marko_salonen
Contributor
0 Kudos

Actually you don't implement anything special, it is all handled in the persistence layer. Just activated it by setting property persistence.legacy.mode to false.

Former Member
0 Kudos

Thank you for quick response .

But my requirement is to create the records for the first time and from the second time i should update the same record in the database using this approach. Could share me the code base for doing this.

Will the following code do the above functionality

**PersistenceUtils.doWithSLDPersistence(() -> { final TitleModel title = modelService.create(TitleModel.class); title.setCode("foo"); modelService.save(title);

 return title;

});**

Former Member
0 Kudos

Thank you for quick response .

But my requirement is to create the records for the first time and from the second time i should update the same record in the database using this approach. Could share me the code base for doing this.

Will the following code do the above functionality

**PersistenceUtils.doWithSLDPersistence(() -> { final TitleModel title = modelService.create(TitleModel.class); title.setCode("foo"); modelService.save(title);

 return title;

});**

Thank you