1) The deleteByID() function is throwing an error for me. tx is
undefined. It's coming from the convertIDValueToJavaType() function,
line 895
2) When passing in an array of ids into the getAll() function, the
BaseORMService is doing an entityLoadByPK for each id in the array.
This strikes me being very inefficient since each entityLoadByPK call
will run a SQL query if the entity is not in the current session. Was
there a reason for doing it this way over using a single query?
Something similar to what deleteById() does.
3) I had to overload the get() function cause it was causing me
frustration. The problem is that it always returns an entity. Most of
the time I don't want a new entity. I could just call entityLoadByPK
and get the behavior I want but I'd rather keep all my ORM interaction
going through the service. Maybe we can add a load() function that
does this?
Also the test for the presence of the id is tickling my OCD bone...
The whole ID EQ 0 check..... I have compound keys and I never get a
new object back when I would expect it. Maybe we can change the
function to:
any function get(required string entityName,required any id) {
var entity = entityLoadByPK(arguments.entityName, arguments.id);
if (isNull( entity ) ) {
return new(arguments.entityName);
} else {
return entity;
}
}
Sure this will always execute a query whereas the current one doesn't
when there isn't a "valid" id, but I fell strong enough that testing
the presence of an id value should not be implied by the service.
If the change would be too much impact, just adding this load()
function would make me happy:
any function load (required string entityName, required any id,
boolean returnNew=false) {
var entity = entityLoadByPK(arguments.entityName, arguments.id);
if (isNull( entity ) AND arguments.returnNew ) {
return new(arguments.entityName);
} else if (!isNull(entity)){
return entity;
}
}
thanks,
.brett