Use both neo4j and postgres in same project

Hello,

I use sdn rx library and i have a postgres database also, i want to know if i can use the 2 db in the same project ?

Thank you

Yes you can, do you have any specific questions about it? I just wrote a python script that connects to Postgres, reads all the data from my Postgres database and wrote it to Neo4j without any issues.

Yes using both complementary to each other is perfectly ok.

I have in a service with two transactional operations, the first with a neo4j and the second with postgres like this :

neo4jService.addAlertLabel(alert);
alert.setEndDate(new Timestamp(receivedAlert.getTimestamp()*1000));
alertRepository.save(alert);

addAlertLabel(alert) will add a label to a node in the neo4j graph
alertRepository.save(alert) will save an entity in the postgres db

the operation with neo4j is good but the seconde operation (the save in postgres) does not work (i have no error but it don't find the entity in the db)

I use the sdn rx library, before when i used neo4j-java-driver it worked well.

Do you use @Transactional on your methods? This should make both transaction managers (Neo4j and JPA(?)) aware of an ongoing Spring transaction and they will share their state information.

yes i tried @Transactional i have this error :


Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.transaction.TransactionManager' available: expected single matching bean but found 2: transactionManager,reactiveTransactionManager

@Transactional from springframework transaction or javax.transaction ?