Except Account class does NOT extend BaseEntity, as stated in my question. Thanks anyway, I appreciate your help nevertheless: knowing it is a problem related to how I use JPA, as opposed to how I use OX, is already very useful.
Except Account class does NOT extend BaseEntity, as stated in my question. Thanks anyway, I appreciate your help nevertheless.
Except Account class does NOT extends BaseEntity, as stated in my question. Thanks anyway, I appreciate your help nevertheless.
I have this validation logic in place in my BaseEntity class. Then almost all other @Entity classes of my project extend BaseEntity, except Account: @AssertTrue(message="Not allowed") private boolean checkPerms() { TypedQuery<Account> aq = XPersistence.getManager() .createQuery("SELECT a FROM Account a WHERE a.username=:name", Account.class); aq.setParameter("name", Users.getCurrent()); Account acc = aq.getSingleResult(); return acc.roles.contains(Role.EDITOR.label); } When I try to update some entity,...
I have this validation logic in place in my BaseEntity class. Then almost all other @Entity classes of my project extend BaseEntity, except Account: @AssertTrue(message="Not allowed") private boolean checkPerms() { TypedQuery<Account> aq = XPersistence.getManager() .createQuery("SELECT a FROM Account a WHERE a.username=:name", Account.class); aq.setParameter("name", Users.getCurrent()); Account acc = aq.getSingleResult(); return acc.roles.contains(Role.EDITOR.label); } When I try to update some entity,...
I have this validation logic in place in my BaseEntity class. Then almost all other @Entity classes of my project extend BaseEntity, except Account: @AssertTrue(message="Not allowed") private boolean checkPerms() { TypedQuery<Account> a = XPersistence.getManager().createQuery("SELECT a FROM Account a WHERE a.nomeUtente=:nome", Account.class); a.setParameter("nome", Users.getCurrent()); Account acc = a.getSingleResult(); return acc.ruolo.contains(Role.EDITOR.label); } When I try to update some entity,...
I have this validation logic in place in every entity of my project (in a BaseEntity class): @AssertTrue(message="Not allowed") private boolean checkPerms() { TypedQuery<Account> a = XPersistence.getManager().createQuery("SELECT a FROM Account a WHERE a.nomeUtente=:nome", Account.class); a.setParameter("nome", Users.getCurrent()); Account acc = a.getSingleResult(); return acc.ruolo.contains(Role.EDITOR.label); } When I try to update some entity, I get a StackOverlowError because this function is...
Can you please provide me with an example of how to do a calculated collection with OpenXava, or point me to some documentation about that? The base filtering logic would be something simple along the lines of SomeEntity[] results = ...; String cu = Users.getCurrent(); return Arrays.stream(results).filter(x -> x.getOwner().equals(cu)).toArray(); but I don't understand where I should write such code in OpenXava.