0
Dear friends, I am using locally a code downloaded from Github for educational purposes and I am having trouble deploying War, the error has to do with a reserved word from the database used in the roles table Caused by: org.postgresql.util.Psqlexception: ERROR: syntax error on or next to "Authorization\\"
The Project makes use of JSF, Hibernate ie is a Web project and as it makes use of JPA I directed to the use in the Postgre database originally it is tested in Mysql So my question is does there exist how to resolve this issue without needing to change the bank?
Note: the project belongs to Mr. Arthur Gregorio https://github.com/arthurgregorio/web-budget
I’ll put some class information
a) entity
@Entity
@Table(name = "roles")
@IdentityManaged(Role.class)
public class RoleTypeEntity extends AbstractIdentityTypeEntity {
@Column(name = "authorization")
private String authorization;
b) a consultation
final List<Role> roles = queryBuilder.createIdentityQuery(Role.class)
.where(queryBuilder.equal(Role.AUTHORIZATION, authorization)).getResultList();
c) a class that is not annotated is not an entity
@Named
@Dependent
public class Authorization {
Sets the class code as error ...
– rray
Authorization is a reserved word in postgresql, see which class is using it as a table name and change to another name. probably using the @table("Authorization") annotation, something like that.
– Geferson
No, there is no entity class or be annotated with @table as you exemplified, I will edit the question with more information about the system classes.
– Robson
Is the name of the Authorization column in the Roletypeentity class, changes the name of that column to another name to see if it works
– adelmo00
You can use the
delimited identifier
orquoted identifier
of Postgresql https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS. Use:@Column(name = "\"authorization\"")
to embed the quotes to what is sent to Postgresql.– anonimo