Trigger on table and hibernate

Sorry I completely have no knowledge and need to know about a trigger on a table represented in hibernate. I come from the python world. What I am trying to do is update an audit table when an update on a table represented in hibernate occurs using a trigger on a table represented in hibernate without changing anything in code (cause the team won’t do that) or changing any representation in hibernate (they likely won’t do that ether). I need to figure out when the table is changed and there is no lastupdate timestamp on the table. What I was hoping to do with no impact to existing stuff is add a trigger in the database, and hopefully that trigger gets handled by the database when the update occurs and hibernate won’t have a fit because it handles the update statement but the trigger wasn’t represented in hibernate. Is this possible? I did find something on stack overflow that seems to imply it is by (trigger can be done by the database or by hibernate) but not sure. Also I am hoping that hibernate won’t have a fit because the audit table that is updated by the trigger isn’t represented in hibernate

I have no idea what hybernate is supposed to be. Is that a Python library? Please take the time a try to formulate a proper question so that people can actually give you an answer without making too many assumptions. All these assumptions just lead to a ping pong question/answer between you and a person like me which is wasting our time and possibly even frustrate us both.

I’ll just assume you meant Hibernate, the Java ORM.

It’s perfectly fine to have a trigger for a table when using Hibernate, so that approach should work. Not sure what the exact question or problem is that you are having. Could you share some more details about what you tried so far and didn’t work?

Another way to do auditing is by using Hibernate Envers, which does the auditing on the ORM level already rather than on the DB level. This requires you to annotate your entities such that Hibernate Envers knows what state to audit though and since you wrote that you can’t change your entities, this is probably not an option for you.