...
CRUD operations example
Code Block |
---|
theme | Eclipse |
---|
language | java | theme | Eclipse |
---|
linenumbers | true |
---|
|
DataDefinition dd = dataDefinitionService.get("plugin", "model");
Entity newEntity = dd.create();
newEntity.setField("name", "xxx");
Entity savedEntity = dd.save(newEntity);
if(savedEntity.isValid()) {
Entity existingEntity = dd.get(savedEntity.getId());
existingEntity.setField("name", "yyy");
dd.save(existingEntity);
dd.delete(existingEntity.getId());
}
|
...
Please see SearcQueryBuilder documentation for more information.
Code Block |
---|
theme | Eclipse |
---|
language | java | theme | Eclipse |
---|
linenumbers | true |
---|
|
DataDefinition dd = dataDefinitionService.get("plugin", "model");
SearchResult result = dd.find("where name = :name").setString("name", "xxx").list();
for(Entity e : result.getEntities()) {
// ...
}
|
...
Please see SearchCriteriaBuilder documentation for more information.
Code Block |
---|
theme | Eclipse |
---|
language | java | theme | Eclipse |
---|
linenumbers | true |
---|
|
DataDefinition dd = dataDefinitionService.get("plugin", "model");
SearchResult result = dd.find().add(SearchRestrictions.eq("name", "xxx").list();
for(Entity e : result.getEntities()) {
// ...
}
|