0

I am not able to provide the proper identifier that resolved properly at hibernate layer.

actualy coulmn AD_USR_ACC_ID but in hibernate query it is getting modified like this - adUsrAccId

i even used naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy but no luck

@Entity
@Table(name = "OWNER.SAMPLE_TABLE")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SampleTableRepo implements Serializable {
    private static final long serialVersionUID = 1L;

    @Column(name = "AD_USR_ACC_ID")
    private Integer adUsrAccId;

converted query like this -

Hibernate: 
    select
        sampleprd0_.adUsrAccId as adUsrAccId9_1_0_
        
    from
        OWNER.SAMPLE_TABLE sampleprd0_ 
    where
        sampleprd0_.adUsrAccId=?
    
    

Error is -

{"message":"could not extract ResultSet [n/a]","timestamp":1629212973851,"log.level":"DEBUG","logger.name":"org.hibernate.engine.jdbc.spi.SqlExceptionHelper","thread.name":"http-nio-8080-exec-1","error.class":"java.sql.SQLSyntaxErrorException","error.message":"ORA-00904: \"SAMPLEPRD0_\".\"ADUSRACCID\": invalid identifier\n","error.stack":"  at 
    
Reese
  • 389
  • 2
  • 10
  • 26
  • how do you create the query? – Simon Martinelli Aug 17 '21 at 15:33
  • Using jpa.finder methods . So it is automatically created – Reese Aug 17 '21 at 15:43
  • Does this answer your question? [Spring Boot + JPA : Column name annotation ignored](https://stackoverflow.com/questions/25283198/spring-boot-jpa-column-name-annotation-ignored) – Henning Aug 17 '21 at 18:01
  • no.. everything is fine where there is one '_' in the column name, but the issue is still same for column 'AD_USR_ACC_ID'. i want this column name to be exactly used in sql query. Has it anything to do with the query that i wrote? – Reese Aug 18 '21 at 06:20
  • Is SampleTableRepo the only entity or does it have any relationships? – Simon Martinelli Aug 19 '21 at 13:39
  • it is resolved as the issue due to the recursive calling of the toString() method between the mapped entitys. I overridden the toString and the stackoverflow issue is gone! Thanks for your help – Reese Aug 19 '21 at 16:38

0 Answers0