AEM supports the use of both Sling APIs and JCR APIs.
The docs mention "While the JCR is AEM’s content repository, its APIs are NOT the preferred method for interacting with the content. Instead prefer the AEM APIs (Page, Assets, Tag, and so on) or Sling Resource APIs as they provide better abstractions."
Furthermore, "Broad use of JCR APIs’ Session and Node interfaces in an AEM application is code-smell. Ensure Sling APIs should be used instead."
Personally, I used the JCR API for creating nodes and properties in custom workflows.
And found it necessary to use the JCR API in the unit tests.
Did you personally come across any use cases where the JCR API is better than the sling API?
And is it always a legitimate code smell?
Hello @jeremylanssiers
You should be able to get some good pointers here https://www.slideshare.net/connectwebex/jcr-sling-or-aem-which-api-should-i-use-and-when
https://stackoverflow.com/questions/45376376/jcr-api-or-apache-sling
I can se only one use case when JCR api is better then Sling API
It is when you write Event on nodetype, which sling does not supports.
Always use Framework API first (AEM <-- Sling <--- JCR)
I agree.
@jeremylanssiers The Sling API works at a higher, more abstract level than the JCR API. JCR is much faster than Sling
Oh well, we are constantly trying to reduce the slack in Sling
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies