Error after created New Entity

Hi, after created a new entityes pedidos and Pedidoslineas, when i enter on Screen Empresas Browse and select any Empresa i get Access Denied.

I’ve recreated all database, but not success :frowning:

Can you help me to see where is the error? (241.9K)

1 Like

Hi Ivan,
The message “Access denied” on opening an editor can be caused by the following:

  • the user has no rights for editing the entity (obviously not your case)
  • the entity has just been deleted (not your case too)
  • the editor cannot load the entity for some reason

Your editor uses quite a complex view (empresas-edit-view) including two nested collections and lots of references. By default, the platform tries to generate an optimal SQL from the loading performance perspective, and sometimes it fails in complex cases. By analyzing the generated SQL, I saw that IMGESTION_CLIENTES table was joined incorrectly through INNER JOIN, which leads to no results if the reference is null. That’s why the editor could not load the entity.

The solution is the following: open the presupuestos-view (which is used in empresas-edit-view) and for the clientes reference set Fetch to UNDEFINED (this is explained here). This leads to loading clientes by a separate SQL and the whole entity graph is loaded successfully.

We will try to fix the issue with automatic SQL generation based on your use case, thanks for reporting it!

Well, additional investigation revealed the real cause. In your clientes-view the tarifa reference Fetch mode is set to JOIN (probably inadvertently). Just clear Fetch mode to make it automatic, and the loading will work. The presupuestos-view changes are not required.

Please be careful with Fetch modes and change them only when needed.

Thanks Konstantin, worked fine after modify cientes-view.

It’s a Bug or it’s possible to alert or see these errors from our side?

Konstantin, i’m getting in same project this error when i create a Listener for Entity pedidos:

Type parameter ‘’ is not within its bound; should implement ‘com.haulmont.cuba.core.entity.BaseEntity’

What’s the reason?


Perhaps you named your listener the same as entity - Pedidos, and our template for listener does not use fully-qualified names in type parameters, so the compilation fails.
Just rename the listener.