tscho created Improvement HHH-7964
Issue Type: Improvement Improvement
Affects Versions: 4.2.0.CR1, 4.1.9
Assignee: Unassigned
Components: core
Created: 01/Feb/13 12:40 PM
Description:

Consider an entity with the following annotations on the ID property and a valid second-level cache configuration. Such an entity is not found in the second-level cache right after session.saveOrUpdate(entity)

@javax.persistence.Id
@javax.persistence.GeneratedValue(strategy = GenerationType.IDENTITY)

The following commented out code snippet in EntityIdentityInsertAction.execute() indicates that caching of newly inserted entities in the second-level cache is currently not supported. The according entity only shows up in the second-level cache after loading from the database.

//TODO: this bit actually has to be called after all cascades!
//      but since identity insert is called *synchronously*,
//      instead of asynchronously as other actions, it isn't
/*if ( persister.hasCache() && !persister.isCacheInvalidationRequired() ) {
	cacheEntry = new CacheEntry(object, persister, session);
	persister.getCache().insert(generatedId, cacheEntry);
}*/

Also entities with database generated IDs should be put in the second-level cache right after insertion in the database.

Project: Hibernate ORM
Priority: Major Major
Reporter: tscho
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira