Thanks Lachlan for the rapid response,

The project is on production now, so we think we should find a solution without 
changing the table definition.

Thanks again for your help.



El 28/11/2011, a las 12:29, Lachlan Deck escribió:

> Never really understood the motivation for using string as a boolean. I would 
> have used the intBoolean prototype :)
> 
> Is that possible for you to try?
> 
> On 29/11/2011, at 5:08 AM, Miguel Angel Torres Avila wrote:
> 
>> Hi list,
>> 
>> We have a table named OrdenServicio in which we have a field named 
>> cxp_generado_cargos_corresponsal_paga defined as varchar(5) (Postgresql)
>> We are using Prototypes and this is the configuration in EOModeler
>> 
>> 
>> <Captura de pantalla 2011-11-28 a la(s) 11.44.43.png>
>> 
>> 
>> Everything works great but now we need to use raw rows to show some reports. 
>> If we load information directly from the OrdenServicio table we have no 
>> problems.
>> 
>>      public static NSArray 
>> reporteOrdenesDeServicioConDistinctRawRows(EOEditingContext ec, NSArray 
>> filtros){
>>              EOAndQualifier andQual = new EOAndQualifier(filtros);
>>              EOFetchSpecification fs = new 
>> EOFetchSpecification(ENTITY_NAME,andQual,
>>                              new NSArray(new Object[]{
>>                                              
>> EOSortOrdering.sortOrderingWithKey(NUMERO_ORDEN_KEY, 
>> EOSortOrdering.CompareAscending)
>>                              }), true, true, null);
>>              fs.setRefreshesRefetchedObjects(true);
>>              fs.setFetchesRawRows(true);
>>              fs.setRawRowKeyPaths(new NSArray<String>(NUMERO_ORDEN_KEY, 
>> CLIENTE_RAZON_SOCIAL_KEY, FECHA_CREACION_KEY, ESTATUS_KEY,
>>                              CARGOS_CORRESPONSAL_PAGA_KEY, 
>> CXP_GENERADO_CARGOS_CORRESPONSAL_PAGA_KEY,
>>                              FEE_PAGADERO_A_CORRESPONSAL_KEY, 
>> CXP_GENERADO_FEE_PAGADERO_A_CORRESPONSAL_KEY,
>>                              
>> CARGOS_COBRADOS_INTERMODAL_NOMBRE_CORRESPONSAL_KEY, 
>> CXP_GENERADO_CARGOS_COBRADOS_INTERMODAL_NOM_CORR_KEY));
>>              return ec.objectsWithFetchSpecification(fs);
>>      }
>> 
>> But, we need to load that info accessing from another table, here are de 
>> relationships between tables:
>> 
>> OrdenServicio < ------ >> OsServicioTipo <---------->> OsServicio
>> 
>> We need a OsServicio's list but want to show the content of the 
>> cxp_generado_cargos_corresponsal_paga field that is on the OrdenServicio 
>> table. Here is the code of the method:
>> 
>>      public static NSArray serviciosParaListaRawRows(EOEditingContext ec, 
>> EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) {
>>              EOFetchSpecification fs = new EOFetchSpecification(ENTITY_NAME, 
>> qualifier, sortOrderings);
>>              fs.setRefreshesRefetchedObjects(true);
>>              fs.setFetchesRawRows(true);
>>              fs.setRawRowKeyPaths(
>>                              new 
>> NSArray<String>(OS_TIPO_SERVICIO_KEY+"."+OsTipoServicio.ORDEN_SERVICIO_KEY+"."+OrdenServicio.NUMERO_ORDEN_KEY,
>>                                              
>> OS_TIPO_SERVICIO_KEY+"."+OsTipoServicio.SERVICIO_TIPO_KEY+"."+ServicioTipo.NOMBRE_KEY,
>>                                              PROVEEDOR_KEY+"."+ 
>> SocioNegocios.RAZON_SOCIAL_KEY,
>>                                              
>> ENCARGADO_KEY+"."+Usuario.USUARIO_KEY,
>>                                              MONEDA_SIGNO_KEY, TARIFA_KEY, 
>> MONEDA_NOMBRE_KEY, ESTATUS_KEY, PARTIDA_KEY, ESTATUS_COBRO_KEY, 
>> CXP_GENERADO_COSTO_KEY,
>>                                              
>> OS_TIPO_SERVICIO_KEY+"."+OsTipoServicio.PARTIDA_KEY,
>>                                              
>> OS_TIPO_SERVICIO_KEY+"."+OsTipoServicio.ORDEN_SERVICIO_KEY+"."+OrdenServicio.CXP_GENERADO_CARGOS_CORRESPONSAL_PAGA_KEY
>>                                              ));
>>              return ec.objectsWithFetchSpecification(fs);            
>> 
>>        }
>> In red the line to access the field. When we run the app get the following 
>> error: 
>> 
>> 
>> ERROR [WorkerThread15] - Super Administrador del Sistema::sysAdmin + 
>> com.toracom.app.components.util.ServicePendingList::filter::java.lang.IllegalStateException:
>>  value type S of attribute 
>> osTipoServicio.ordenServicio.cxpGeneradoCargosCorresponsalPaga of entity 
>> OsServicio is invalid.
>>      at 
>> com.webobjects.jdbcadaptor.JDBCColumn._fetchCorrectObject(JDBCColumn.java:321)
>> 
>> 
>> We have no problem accessing field on the OrdenServicio table because we are 
>> getting the Order Number 
>> (OS_TIPO_SERVICIO_KEY+"."+OsTipoServicio.ORDEN_SERVICIO_KEY+"."+OrdenServicio.NUMERO_ORDEN_KEY).
>> So we think the problem is the Prototype booelan because it converts from 
>> varchar to boolean when it loads to the OrdenServicio Entity but in this 
>> case we are loading data from OsServicio and there is no rule that indicates 
>> how to transform that value.
>> 
>> I think we'll have to create a view on the database and create an entity 
>> just for this report.
>> 
>> Any hints will be appreciated, also if you think I am right to think what is 
>> happening.
>> 
>> Best Regards.
>> 
>> Miguel Angel Torres.
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/lachlan.deck%40gmail.com
>> 
>> This email sent to [email protected]
> 
> Lachlan Deck
> [email protected]
> 
> 
> 
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to