Closed jflute closed 4 months ago
like this:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
The primary-key value in the entity was not found.
[Advice]
An entity should have its primary-key value
when e.g. insert(), update().
For example:
(x):
Member entity = new Member();
entity.setFooName(...);
entity.setFooDate(...);
MemberBhv.updateNonstrict(entity);
(o):
Member entity = new Member();
entity.setFooId(...); // *Point
entity.setFooName(...);
entity.setFooDate(...);
MemberBhv.updateNonstrict(entity);
Or if your process is insert(), you might expect identity.
Confirm the primary-key's identity setting.
Or if you update it by unique column (not PK),
use entity.uniqueBy(...).
For example:
(o):
Member entity = new Member();
entity.uniqueBy(...); // *Point
entity.setFooDate(...);
MemberBhv.updateNonstrict(entity);
[Entity]
Member:{null, sea, mystic, null, null, null, null, null, null, null, null}@875580a9
* * * * * * * * * */
switch by UQ existence:
br.addElement("");
br.addElement("Or if your process is insert(), you might expect identity.");
br.addElement("Confirm the primary-key's identity setting.");
if (!entity.asDBMeta().getUniqueInfoList().isEmpty()) {
br.addElement("");
br.addElement("Or if you update it by unique column (not PK),");
br.addElement("use entity.uniqueBy(...).");
br.addElement("For example:");
br.addElement(" (o):");
br.addElement(" " + classTitle + " entity = new " + classTitle + "();");
br.addElement(" entity.uniqueBy(...); // *Point");
br.addElement(" entity.setFooDate(...);");
br.addElement(" " + behaviorName + ".updateNonstrict(entity);");
}
setupEntityElement(br, entity);
final String msg = br.buildExceptionMessage();
throw new EntityPrimaryKeyNotFoundException(msg);
from Slack: https://dbflute.slack.com/archives/CAPH91CH2/p1658488810025909