Getting entities by PK
When using Active Objects, getting entities given their primary keys is very simple. Of course we will be using the
EntityManager. The actual method is
Note that the
get method take a vararg argument so it is possible to get several entities at once by passing several primary keys to the method. It will then return an array of entities.
This code is a sample extract from the
BlogService implementation of the DogFood blog