DB Triggers and JPA

pts.
Tags:
AS/400
iSeries
JPA
Spring
SQL Anywhere Studio/M-Business Anywhere/Avantgo
Toplink
Triggers
XFire
I have a physical file/table, on an iSeries, into which I drop a record containing UserID and Password. This action in turn fires a trigger that ends up calling the api QSYGETPH to verify the user's login credentials. This has been working for years under our previous architecture, wherein we inserted the record via SQL from a "normal" java program. However, we recently switched our middleware architecture to Spring/XFire, using JPA with Toplink. Now, the record gets inserted, but the trigger doesn't fire. I have tried this with dao.persist, EntityManager.createQuery, and EntityManager.createNativeQuery. In all instances, the record gets dropped into the file, but the trigger doesn't execute. Yet, if I create a record manually with a utility like wrkdbf, the trigger works fine on the file. Any help would be greatly appreciated. R. Grimes

Answer Wiki

Thanks. We'll let you know when a new response is added.

Seems to me if the trigger is working using another program or utility it isn’t the trigger program logic that is wrong.

I would check the authority you might be adopting in the new application to see if that is the cause. We use trigger programs here but they all run under adopted authority to a user with all object authority.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Rdgrimes
    I'm using the same connection User ID and Password as worked on the old non-jpa architecture. Also, since I can see the record getting dropped into the database, there is obviously no problem with my write authority. It's the db's responsibility to detect a inserted record and fire the trigger. But, this is acting as though an insert via jpa is operating under stealth. R. Grimes
    0 pointsBadges:
    report
  • Rdgrimes
    I finally gave up on using a trigger program. Instead I decided to write a java class that uses ProgramCall from the com.ibm.as400.access package. I have ProgramCall execute an iSeries CLP program that, in turn, calls QSYGETPH and QSYRLSPH to validate the user credentials and return a valid/not valid flag. This seems to work just fine for what I'm doing. R. Grimes
    0 pointsBadges:
    report
  • TomLiotta
    If you can demonstrate that the file insert happened and the trigger did not fire, that would call for an immediate problem report to IBM. Personally, I find it very unlikely. Most likely, the trigger logic is indeed incorrect or authority is inappropriate. If triggers failed to fire, IBM Support lines would be burning up. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following