Missmatched token error

I am working with an entity called Order, and the orderBrowse Collection has the query

select e from Order e

whenever I open OrderBrowse it gives me this error

and we believe it is because “order” is a reserved word

previously we used a prefix before using the class name "
select e from projectName_Order e

how can I reach the entity now without it clashing on to reserved words, without changing my entity names?

thank you

You cannot use reserved words in the JPQL.

Therefore you need to change entity name for the Order entity, e.g. to “Order_”:

@Table(name = "ORDER_")
@Entity(name = "Order_")
public class Order {

Jmix Studio 1.0.0 will create entity declaration like I’ve shown above.

thank you that is what is assumed, is there no other way to acces it, even by adressing the whola package?


I think that it is a bad idea to try to escape the problem which can be solved in one minute, by changing entity name.
To have an entity name that is a reserved JPQL word - should be avoided.


Yes I opted for refactoring a huge chunk of the app, because “order” was an important entity that had lots of other entities depending on it, also containing the word “order” in some capacity. That was the part that I was trying to avoid.

Thank you for your help!

You don’t need to refactor your code (I assume you mean renaming your class).

The name used in the JPQL is not class name. It’s the “name” parameter of the @Entity annotation.

So if you have the code:

@Entity(name = "Foo")
public class Bar {

Then the entity name in JPQL queries will be select e from Foo, not Bar.