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(
   at com.whitestein.lsps.engine.lang.RuntimeToPersistentConverter.convertToPersistent(
   at com.whitestein.lsps.engine.lang.RecordHolderImpl.setPropertyInternal(
   at com.whitestein.lsps.engine.lang.RecordHolderImpl.setProperty(
   at com.incomm.launchit.ejb.impl.MasterDataFunctionsImpl.getEncodingTypes(
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
   at java.lang.reflect.Method.invoke(
   at com.whitestein.lsps.engine.lang.JavaOperationExecutorImpl.executeJavaOperation(
   ... 80 more
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