Project X has the following parts:
a. Spring Data repository with separate methods like:
@Cacheable(value = \"xobjects\", unless = \"#result == null\")
X
Your approach will either not work or will be very difficult to maintain. Besides the need for maintaining the cache manually, you would need to merge the entity instances back into each new Hibernate session (persistence context) if you want them to be managed, because the entities you return from your own cache will always be detached.
The best approach is to use Hibernate second-level cache which will do cache entries lifecycle job for you automatically.