Spring Data it is useful framework but in my case sometimes it is too
easy. Two years ago, when I worked in some company, my colleague wrote
some template of framework like this.
It also have
generic implementation for a CRUD operation but you have to write
implementation for other types of operations. It is one another class
which you have to write. It is easy but it doesn't enforce any
convention of methods name.
Other huge advantage is
resolving of types returning in methods. Every type has it's own
meaning. Ex. You can receive a entity or a Optional<Entity> type.
When it is looked for list of elements, there is more options, ex.
Stream (JDK8), List, Set and Page<Entity> type where there is a
information about count of all elements.
Showing posts with label DAO. Show all posts
Showing posts with label DAO. Show all posts
Saturday, 21 November 2015
Monday, 14 September 2015
JPA 2.0
JPA 2.0 has a few useful things like:
- API to basic caching
- Unify database source parameters, ex username or password
- Improve lock modes
- Use advanced JPQL language to create queries
- Extends presisting API
ResultSet by Hibernate
In hibernate you can use 3 types of Scrollable ResultSet:
TYPE_SCROLL_INSENSITIVE - it is possible to get selected row of data and retrieve data forward and backward. There is not sensitive for external changes in db, so as I got to know refresh is impossible.TYPE_SCROLL_SENSITIVE - the same as above but it is sensitive for external changes in db. After calling refresh you get new entity from db.TYPE_FORWARD_ONLY - it is possible to get data only forward order, you can't get selected row. It is necessary to go in loop by next method.
Subscribe to:
Posts (Atom)