IllegalStateException exception when loading the file uploaded earlier

I have a composite entity where I can upload multiple files and saves successfully.

However, when I try to display the record for in Edit mode, I am getting the following error:

java.lang.IllegalStateException: Cannot get unfetched attribute [createTs] from detached object com.haulmont.cuba.core.entity.FileDescriptor-7829a929-26cb-a89c-7087-ff75ebe526ad [detached].
	at org.eclipse.persistence.internal.queries.EntityFetchGroup.onUnfetchedAttribute(
	at com.haulmont.cuba.core.sys.persistence.CubaEntityFetchGroup.onUnfetchedAttribute(
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.processUnfetchedAttribute(
	at com.haulmont.chile.core.model.impl.AbstractInstance._persistence_checkFetched(
	at com.haulmont.cuba.core.entity.StandardEntity._persistence_get_createTs(
	at com.haulmont.cuba.core.entity.StandardEntity.getCreateTs(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodA

Is there any clue why this type of exception is thrown?

In the platform 6.3, views do not include system attributes (createTs, createdBy, updateTs, etc.) by default. See the Breaking changes section of the release notes.

In order to include all system attributes to a view, select System properties checkbox in Studio or set systemProperties view attribute to true in XML.

Thanks but it is still not working. Please see how i have checked the systemProperties check box in attached image. Note that the attached files are composition entity and the view includes those attributes though.

IllegalStateException: Cannot get unfetched attribute [createTs] from detached object com.haulmont.cuba.core.entity.FileDescriptor-0910bd37-5c5d-68f1-8320-68054070fd4b [detached].


Could you provide employee-view in the part where it defines the reference to FileDescriptor?

Hi Konstantin
Here is the employee view where attached document composition is …



Hi Mortoza,

Probably you have selected _local view for the attachment attribute. It does not contain createTs and the top-level System properties checkbox does not affect it because it is a named view. Try to remove any view for this attribute and just select all attributes inside - it will be a in-line view and the top-level System properties checkbox value will be propagated to it.

Another option would be to find out why you need createTs of file descriptor in the first place?

Thank you, it worked that way.

Why was this change made? Would it be unwise to simply check “System properties” in every view?

It was made for performance reasons, to reduce the number of columns read from the database for every entity instance. Usually these system attributes are not needed in UI or business logic, so why load them, serialize, pass to client, keep in memory?

In fact, the “System properties” flag didn’t work in versions 6.0…6.2 - the system attributes loaded anyway. Now you have this option. Of course you can check “System properties” in every view, but I would suggest to do it only where needed.