开发者

Postgres DB Trigger calling Java Function

Is it possible to define a trigger in a postgres DB that can call some Java function?

(I believe the above is possible in Oracle, but want to know if it for postgres).

So if this is possible, does this mean that the Java开发者_开发技巧 function would be called for every client application that is connected to the DB which of course has the function defined?

Thnx.


There is the PL/Java add-on:

PL/Java is a free add-on module that brings Java™ Stored Procedures, Triggers, and Functions to the PostgreSQL™ backend via the standard JDBC interface.

I haven't used it so I can't comment on how good it is.


I don't know if it can fit your needs, but if you're using Hibernate to communicate with the DB, you can use Hibernate event listeners as triggers ( http://docs.jboss.org/hibernate/core/3.3/reference/en/html/events.html , http://docs.jboss.org/hibernate/core/3.3/api/org/hibernate/event/package-summary.html). That way it would work whatever the DB is (given you use standard SQL queries or HQL queries in the triggers)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜