sqlspringopenedgeprogress-4glprogress-db

Spring and Progress-4GL - Change JPA schema naming query format


I have a Spring Boot Application which connects to a Progress Open Edge Database (NOT postgree).

But I am having some issues when trying to get data from Progress Table, it returns the following error when I call methods such "findAll()" or "findById()":

Table/view/synonynm "EMS2ESP.INTEG_TABLE_003C" cannot be found. (15814) (-210083)

But, "INTEG_TABLE_003C" does exist in "EMS2ESP" database. When running the select directly it works correctly.

I am trying with the following properties in my application.properties:

spring.datasource.url=jdbc:datadirect:openedge://HOM-DB-01:25475;databaseName=ems2esp
spring.datasource.username=sysprogress
spring.datasource.password=sysprogress
spring.datasource.driver-class-name=com.ddtek.jdbc.openedge.OpenEdgeDriver
spring.datasource.database-platform=org.hibernate.dialect.SQLServerDialect

And this is one of my entities:

@Entity
@Table(name = "INTEG_TABLE_003C")
@Data
public class Progress003c extends IntegTable003c {
 // Class properties and etc...
}

I would like to make Spring remove the "EMS2ESP" schema from the generated query because I saw some online posts saying that this could cause the error above.

How can I do that? Thank you


Solution

  • I managed to solve the issue by doing the following:

    1. In "application.properties" I put the following lines

      spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
      
      spring.jpa.hibernate.naming.implicit-strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
      
    2. In the connection string I added ";INITIALIZATIONSTRING=set schema 'PUB'" at the very end. It looks like this now:

      spring.datasource.url=jdbc:datadirect:openedge://HOM-DB-01:25475;databaseName=ems2esp;INITIALIZATIONSTRING=set schema 'PUB'
      

    Also, I had to ensure that "schema" property in @Table annotation should NOT be defined:

    @Table(name = "INTEG_TABLE_003C", schema="DO NOT DEFINE SCHEMA")