PostgreSQL Reserved Word Problems

0

I'm using locally a code downloaded from GitHub for educational purposes and I'm having problems doing the deploy of war, the error has to do with a reserved word from the bank used in the roles table Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near \\ "authorization \\"

The project makes use of JSF, ie Hibernate is a Web project and as it makes use of the JPA I directed it to use in the Postgre bank originally it is tested in MySQL So my question is is there how to resolve this issue without having to change the bank?

Note: the project is by Mr. Arthur Gregorio link

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 query

final List<Role> roles = queryBuilder.createIdentityQuery(Role.class)
            .where(queryBuilder.equal(Role.AUTHORIZATION, authorization)).getResultList();

c) a class is not annotated or is not an entity

@Named
@Dependent
public class Authorization {
    
asked by anonymous 27.06.2016 / 15:21

1 answer

0
  

So my question is how do I resolve this issue without having to change the bank?

Yes, changing the code. Change the name of the column where you have the reserved word authorization:

@Column(name = "auth") // Muda o nome aqui!
private String authorization;

This should solve your problem. I hope I have helped ^^

    
01.09.2016 / 03:16