Bug 154 : discriminatorType = DiscriminatorType.INTEGER - A type for discriminator value [0] was not found?
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.1.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
15/09/2009
Updated 
15/09/2009
Type 
Bug
 
Attachments 
No attachments

ran into a wee bug as follows
I had a class defined as follows
@DiscriminatorColumn(name = "manager_type", discriminatorType = DiscriminatorType.INTEGER)
@DiscriminatorValue("0")
public class ResourceManager extends DomainObject {

but I was getting the following error
testStandardResourceManager(com.imilia.bkf.service.QueryServiceTest) Time elapsed: 0.054 sec <<< ERROR!
javax.persistence.PersistenceException: A type for discriminator value [0] was not found?
at com.avaje.ebean.server.deploy.InheritInfo.readType(InheritInfo.java:155)
at com.avaje.ebean.server.deploy.BeanPropertyAssocOne$Reference.readSet(BeanPropertyAssocOne.java:316)
at com.avaje.ebean.server.deploy.BeanPropertyAssocOne.readSet(BeanPropertyAssocOne.java:218)
at com.avaje.ebean.server.query.SqlTreeNodeBean.load(SqlTreeNodeBean.java:228)
at com.avaje.ebean.server.query.CQuery.readRow(CQuery.java:513)
at com.avaje.ebean.server.query.CQuery.readBeanInternal(CQuery.java:545)
at com.avaje.ebean.server.query.CQuery.readTheRows(CQuery.java:629)
at com.avaje.ebean.server.query.CQuery.readCollection(CQuery.java:613)
at com.avaje.ebean.server.query.CQueryEngine.findMany(CQueryEngine.java:164)
at com.avaje.ebean.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:87)
at com.avaje.ebean.server.core.OrmQueryRequest.findSet(OrmQueryRequest.java:231)
at com.avaje.ebean.server.core.DefaultServer.findSet(DefaultServer.java:1101)
at com.avaje.ebean.server.deploy.BeanSetHelp.refresh(BeanSetHelp.java:81)
at com.avaje.ebean.server.deploy.BeanPropertyAssocMany.refresh(BeanPropertyAssocMany.java:197)
at com.avaje.ebean.server.core.DefaultServer.refreshManyInternal(DefaultServer.java:357)
at com.avaje.ebean.server.core.DefaultServer.lazyLoadMany(DefaultServer.java:304)
at com.avaje.ebean.common.BeanSet.init(BeanSet.java:136)
at com.avaje.ebean.common.BeanSet.size(BeanSet.java:351)
at java.util.ArrayList.(ArrayList.java:133)
at com.imilia.bkf.access.ServiceProvider.getResourcesSortedByOid(ServiceProvider.java:274)
at com.imilia.bkf.service.QueryServiceTest.testStandardResourceManager(QueryServiceTest.ja

now the problem lies in the following code
public InheritInfo readType(DbReadContext ctx) throws SQLException {


String discValue = ctx.getRset().getString(ctx.nextRsetIndex());


if (discValue == null){
return null;
}


InheritInfo typeInfo = root.getType(discValue);
if (typeInfo == null){
String m = "A type for discriminator value ["+discValue+"] was not found?";
throw new PersistenceException(m);
}


return typeInfo;
}

root.getType simply looks up the discMap using the String value discValue - which fails ("0" is not 0)
The workaround was for me to use the DiscriminatorType.STRING - which works fine as you can probably understand

 
Rob 15 Sep 08:54
Fixed in HEAD

Issue was different datatypes comparison in Map.
Fixed in HEAD.

woResponse

Upload a file