Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

java - Configure two databases in spring boot for entity manager without entity classes

I connected db2 database from spring boot and called stored procedures using entity manager. I didnt have any entity classes in my application. I just called stored procedures using Entity Manager reference.

Here application.properties

#DB2 dev database config
spring.datasource.url=jdbc:db2://server_nameXXX
spring.datasource.username=my_username
spring.datasource.password=my_password

And My Dao class is

EntityManager entityManager;
    @Autowired
    public SalesCloseEstimateDaoImpl(EntityManager entityManager){
        this.entityManager = entityManager;
    }
   -----------------
    StoredProcedureQuery procedureQuery =  entityManager.createStoredProcedureQuery(StoredProcedureName);

Here I didnt use any entity classes. Now I need to connect one more ms sql server, so how can I connect it. I have searched but all configuration having entity classes usage how can I write this configuration without entity classes?

question from:https://stackoverflow.com/questions/65881179/configure-two-databases-in-spring-boot-for-entity-manager-without-entity-classes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...