Hi,
I've been using DataObjects with Cayenne for several years. After porting to
MSSQL, I'm now encountering a very strange problem. The class below
represents a table called MessageType. I access it with this call:
public static MessageType getMessageType(Integer id,
DataContext ctx)
throws
CayenneRuntimeException, Exception {
//MessageType linfo = (MessageType)
DataObjectUtils.objectForPK(ctx, MessageType.class, id.intValue());
ObjectId oid = new ObjectId("MessageType",
MessageType.ID_PK_COLUMN, id);
//this constructor implicitly uses
"CACHE_REFRESH" policy, so a fresh object will be returned
ObjectIdQuery query = new
ObjectIdQuery(oid);
MessageType linfo = (MessageType)
DataObjectUtils.objectForQuery(ctx, query);
return linfo;
}
Both the .objectForPK() and the .objectForQuery return a ClassCastException
on the MessageType (below); this never happened before. I can't for the life
of me imagine what is happening.
-david norwood
Caused by: com.virtuant.mobilitee.exception.ServiceException:
com.virtuant.mobilitee.exception.ServiceException:
java.lang.ClassCastException: com.virtuant.mobilitee.db.MessageType
at
com.virtuant.mobilitee.helper.DroolsHelper.getWorkingMemory(DroolsHelper.jav
a:85)
at
com.virtuant.mobilitee.ejb.RuleControllerBean.getUserList(RuleControllerBean
.java:161)
... 73 more
Caused by: com.virtuant.mobilitee.exception.ServiceException:
java.lang.ClassCastException: com.virtuant.mobilitee.db.MessageType
at
com.virtuant.mobilitee.helper.DroolsHelper.getRule(DroolsHelper.java:174)
at
com.virtuant.mobilitee.helper.DroolsHelper.getRule(DroolsHelper.java:127)
at
com.virtuant.mobilitee.helper.DroolsHelper.getWorkingMemory(DroolsHelper.jav
a:75)
... 74 more
Caused by: java.lang.ClassCastException:
com.virtuant.mobilitee.db.MessageType
at
com.virtuant.mobilitee.helper.DBHelper.getMessageType(DBHelper.java:400)
at
com.virtuant.mobilitee.helper.DBHelper.getMessageType(DBHelper.java:372)
at
com.virtuant.mobilitee.helper.DroolsHelper.getRule(DroolsHelper.java:165)
... 76 more
package com.virtuant.mobilitee.db.auto;
import java.util.List;
/** Class _MessageType was generated by Cayenne.
* It is probably a good idea to avoid changing this class manually,
* since it may be overwritten next time code is regenerated.
* If you need to make any customizations, please use subclass.
*/
public class _MessageType extends com.virtuant.mobilitee.common.DBObject {
public static final String FILENAME_PROPERTY = "filename";
public static final String NAME_PROPERTY = "name";
public static final String PROCESSID_PROPERTY = "processid";
public static final String URL_PROPERTY = "url";
public static final String INBOX_ARRAY_PROPERTY = "inboxArray";
public static final String OUTBOX_ARRAY_PROPERTY = "outboxArray";
public static final String TO_RULE_PROPERTY = "toRule";
public static final String ID_PK_COLUMN = "ID";
public String getFilename() {
return (String)readProperty("filename");
}
public String getName() {
return (String)readProperty("name");
}
public Integer getProcessid() {
return (Integer)readProperty("processid");
}
public String getUrl() {
return (String)readProperty("url");
}
public void addToInboxArray(com.virtuant.mobilitee.db.Inbox obj) {
addToManyTarget("inboxArray", obj, true);
}
public void removeFromInboxArray(com.virtuant.mobilitee.db.Inbox obj) {
removeToManyTarget("inboxArray", obj, true);
}
public List getInboxArray() {
return (List)readProperty("inboxArray");
}
public void addToOutboxArray(com.virtuant.mobilitee.db.Outbox obj) {
addToManyTarget("outboxArray", obj, true);
}
public void removeFromOutboxArray(com.virtuant.mobilitee.db.Outbox obj)
{
removeToManyTarget("outboxArray", obj, true);
}
public List getOutboxArray() {
return (List)readProperty("outboxArray");
}
public com.virtuant.mobilitee.db.Rule getToRule() {
return (com.virtuant.mobilitee.db.Rule)readProperty("toRule");
}
This archive was generated by hypermail 2.0.0 : Thu Oct 12 2006 - 08:05:23 EDT