I am new to JPA and I have started using it recently. I have a doubt with the following method which was introduced in JPA 2.0 -
public <T> T find(Class<T> entityClass, Object primaryKey,
Map<String, Object> properties);
The documentation says, Find by primary key, using the vendor specified properties.
But I am unable to understand what are those vendor specific properties and under what situation this overloaded find() method should be used.
Can any one explain this to me with a suitable example. Thanks in advance.
Look here, it's a list of query hints for Hibernate
. For Eclipselink
you can use these hints.
You can use hints in property map like this:
Map<String, Object> map = new HashMap<>();
map.put("org.hibernate.cacheMode", CacheMode.REFRESH);
MyClass myClass = em.find(MyClass.class, 1L, map);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With