Entity Log unfetched attribute

Cuba 7.2

I have extended Sec.User entity as a new entity called Account.

When I create a log for Account and try to access the Entity Log screen I get the Unfetched Attribute exception. Stack trace attached.

account_error

account_stack.txt (13.4 KB)

Hi!
Could you please provide more information about your problem and if it is possible, attached a small project that reproduced it?
Please try to update the platform version, a similar problem was fixed in the platform version 7.2.11.

Regards,
Elena

Hi Skatova,

Thank you for the reply.

The error seems to be if I include the custom value (accountNumber) into the instance name.

@PublishEntityChangedEvents
@Entity(name = "billing_Account")
@NamePattern("%s %s|name,accountNumber")
public class Account extends User implements Categorized, XeroEntity {
    private static final long serialVersionUID = -5628965645560824192L;

    @Column(name = "ACCOUNT_NUMBER", unique = true, length = 25)
    private String accountNumber;

Updating the platform version has not resolved this issue.

Thank you for reporting the problem. We have created a GitHub issue.

1 Like

Hi Daryn!

The root cause of your problem is described in git hub issue. Cut to the chase it is expected behaviour.

But if you want to replace the User entity with an Account entity you should use Extends annotation.
For details see documentation

Hi @v.plakhov ,

Thank you for your reply.

However, if I add the @Entity Annotation I get the error:

Caused by: java.lang.RuntimeException: Unable to create anonymous session. It is required for system to start

...

Caused by: com.haulmont.cuba.security.global.LoginException: Unknown login name or bad password 'anonymous

Entity:

@Entity(name = "billing_Account")
@PublishEntityChangedEvents
@Extends(User.class)
@NamePattern("%s %s|name,accountNumber")
public class Account extends User implements Categorized, XeroEntity {
    private static final long serialVersionUID = -5628965645560824192L;

Also, you shall set the “dtype” field as ''billing_Account" for all rows from the “SEC_USER” table,
because “Extends” annotation works as full-replacement for the “User” entity.

Thanks @v.plakhov,

I don’t want to replace “User” completely with “Account” as I.e I might have “users” that are not “customers/accounts” e.g. staff members using the system.

Or do I need to create an ExtUser class and an Account class that both extend User.class?

Thank you I’m advance.