I am participating in a project that uses the JPA implementation for EclipseLink to talk to a PostgreSQL database. I have a task for which PostgreSQL NOTIFY / LISTEN seems ideally suited. Unfortunately, I'm new to JPA, and I'm struggling to figure out how to make it work. Therefore, I think I have two questions; an answer to me will make me happy.
1) What is the best way for me to get a direct JDBC connection to the database? (Which, I sincerely hope, will be of type org.postgresql.PGConnection .)
OR
2) What is the best way to emulate / access org.postgresql.PGConnection.getNotifications() via EclipseLink JPA?
Thank you very much for your help.
Edit: Two working solutions! I like this site. If anyone can say anything about hidden errors / benefits that will make the Pascal or Balus solution better than the other, before I post a checkmark, I would like to hear it.
source share