mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 22:56:28 +00:00
#115 - Mapping - Add support for @ElementCollection enhancement
Add element collection L2 cache support
This commit is contained in:
1 parent
07946cd505
commit
acd5578d8a
52 files changed
+734
-135
No files matched your search
@@ -6,12 +6,18 @@ import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Base for saving entity bean collections and element collections.
|
||||
*/
|
||||
abstract class SaveManyBase {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SaveManyBase.class);
|
||||
|
||||
final PersistRequestBean<?> request;
|
||||
final SpiEbeanServer server;
|
||||
final boolean insertedParent;
|
||||
@@ -48,4 +54,17 @@ abstract class SaveManyBase {
|
||||
}
|
||||
c.modifyReset();
|
||||
}
|
||||
|
||||
void postElementCollectionUpdate() {
|
||||
if (!insertedParent) {
|
||||
if (request.postElementCollectionUpdate()) {
|
||||
try {
|
||||
String asJson = many.jsonWriteCollection(value);
|
||||
request.addCollectionChange(many.getName(), asJson);
|
||||
} catch (IOException e) {
|
||||
log.error("Error build element collection entry for L2 cache", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user