RecordHolder population error

Discussions about modeling, execution and management of process/application data.
Forum rules
Make sure every topic contains information about your LSPS version and if relevant also your server OS, client OS, database name and version, and application server name and version.
Byron Glueck
 
Posts: 85
Joined: Thu Apr 26, 2012 8:17 pm

RecordHolder population error

Fri Oct 04, 2013 11:34 pm

We have a simple unshared record with an Integer field named 'id' (image attached).

When attempting to populate a RecordHolder property with an Integer value, a run-time error occurs.

Sample code:
Code: Select all
      RecordHolder result;
      Map<String, Object> properties = new HashMap<String, Object>();
      
      Integer i = 1;
      properties.put("id", i);
             
      result = context.getNamespace().createRecord(typeName, properties);


Stack trace:
Code: Select all
2013-10-04 17:19:14,848 INFO LspsUI stacktrace
...
Caused by: com.whitestein.lsps.common.ErrorRuntimeException: Object 777 cannot be assigned to type Integer, error code: IncompatibleTypeError
   at com.whitestein.lsps.engine.lang.RuntimeToPersistentConverter.validate(RuntimeToPersistentConverter.java:555)
   at com.whitestein.lsps.engine.lang.RuntimeToPersistentConverter.convertToPersistent(RuntimeToPersistentConverter.java:184)
   at com.whitestein.lsps.engine.lang.RecordHolderImpl.setPropertyInternal(RecordHolderImpl.java:143)
   at com.whitestein.lsps.engine.lang.RecordHolderImpl.setProperty(RecordHolderImpl.java:128)
   at com.incomm.launchit.ejb.mdm.data.EncodingTypeFactory.transform(EncodingTypeFactory.java:46)
   at com.incomm.launchit.ejb.mdm.data.EncodingTypeFactory.transform(EncodingTypeFactory.java:62)
   at com.incomm.launchit.ejb.impl.MasterDataFunctionsImpl.getEncodingTypes(MasterDataFunctionsImpl.java:56)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at com.whitestein.lsps.engine.lang.JavaOperationExecutorImpl.executeJavaOperation(JavaOperationExecutorImpl.java:96)
   ... 80 more
Attachments
Screen Shot 2013-10-04 at 4.35.34 PM.png
Screen Shot 2013-10-04 at 4.35.34 PM.png (16.27 KiB) Viewed 3439 times

Milos Volauf
 
Posts: 10
Joined: Mon Feb 27, 2012 2:49 pm

Re: RecordHolder population error

Mon Oct 07, 2013 10:44 am

The model type Integer is in Java represented by class com.whitestein.lsps.lang.Decimal

The corrected code looks like this:
Code: Select all
          RecordHolder result;
          Map<String, Object> properties = new HashMap<String, Object>();

          Integer i = 1;
          properties.put("id", new com.whitestein.lsps.lang.Decimal(i));

          result = context.getNamespace().createRecord(typeName, properties);

Return to Data modeling

Who is online

Users browsing this forum: No registered users and 1 guest