Hello, I am trying to insert data in a database where a custom function is call in a trigger after the insertion.
But as I am using JPA, I tryied this code :
public EntityManager newEm()
{
final EntityManager em = emf.createEntityManager();
final Connection connection = em.unwrap(Connection.class);
try
{
Function.create(connection, "title_sort", new Function()
{
@Override
protected void xFunc() throws SQLException
{
result(value_text(0));
}
});
}
catch(final SQLException e)
{
LOGGER.error("!!!!!", e);
}
return em;
}
As you can see, I am trying to add the function on the entity manager, but the Connection instance is not recognized, and therefore the insertion fail.
Any idea on how to do so ?
Thanks.
Best regards.