Hello,
I have seen that there is the prototype mutableArray in the EOModeler
I'm using FrontBase, this prototype by default set external type BLOB and use methods fromBlob e toBlob
My entity is called CFNewsLetter, here the piece on _CFNewsLetter
public ERXMutableArray staticArticles() { return (ERXMutableArray) storedValueForKey("staticArticles"); }
public void setStaticArticles(ERXMutableArray value) { if (_CFNewsLetter.LOG.isDebugEnabled()) { _CFNewsLetter.LOG.debug( "updating staticArticles from " + staticArticles() + " to " + value); } takeStoredValueForKey(value, "staticArticles"); }
now, static aticle is an object that have whit his serializable methods, the class is called CFNewsLetterItem, here the relevant piece of code:
public class CFNewsLetterItem implements Serializable {
/** * */ private static final long serialVersionUID = 782612934512287294L; protected String title; protected String link; protected String area; protected String categoria;
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException { stream.writeObject(title); stream.writeObject(link); stream.writeObject(area); stream.writeObject(categoria); }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { title = (String) in.readObject(); link = (String) in.readObject(); area = (String) in.readObject(); categoria = (String) in.readObject(); }
Now, storing is working fine, but when I try to read object I have this cast error
Sure I'm missing something, but I don't know where, this is the rist time I store array is database.
Can you help me? Regards Amedeo
Mar 12 18:16:56 ConfindustriaNet[22500] INFO er.transaction.adaptor.Exceptions - Database Exception occured: java.lang.ClassCastException: er.extensions.foundation.ERXMutableArray Mar 12 18:16:56 ConfindustriaNet[22500] WARN NSLog - <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request: java.lang.ClassCastException: er.extensions.foundation.ERXMutableArray [2009-3-12 18:16:56 CET] <WorkerThread0> java.lang.ClassCastException: er.extensions.foundation.ERXMutableArray at com.webobjects.jdbcadaptor.JDBCColumn._fetchCorrectObject(JDBCColumn.java:273) at com.webobjects.jdbcadaptor.JDBCColumn._fetchValue(JDBCColumn.java:384) at com.webobjects.jdbcadaptor.JDBCColumn.fetchValue(JDBCColumn.java:372) at com.webobjects.jdbcadaptor.JDBCChannel.fetchRow(JDBCChannel.java:1462) at com.webobjects.eoaccess.EODatabaseChannel._fetchObject(EODatabaseChannel.java:321) at com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:3071) at com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(EODatabaseContext.java:3195) at com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488) at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4069) at er.extensions.eof.ERXEC.objectsWithFetchSpecification(ERXEC.java:1114) at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4444) at it.chieti.confindustria.components.CFPGNewsLetterList.appendToResponse(CFPGNewsLetterList.java:29) at com.webobjects.appserver.WOSession.appendToResponse(WOSession.java:1385) at er.extensions.appserver.ERXSession.appendToResponse(ERXSession.java:540) at com.webobjects.appserver.WOApplication.appendToResponse(WOApplication.java:1794) at er.extensions.appserver.ERXApplication.appendToResponse(ERXApplication.java:1639) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedPage(WOComponentRequestHandler.java:242) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedSession(WOComponentRequestHandler.java:298) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication(WOComponentRequestHandler.java:332) at com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(WOComponentRequestHandler.java:369) at com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WOComponentRequestHandler.java:442) at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687) at er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:1737) at er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:1702) at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144) at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226) at java.lang.Thread.run(Thread.java:613)
|