trigger « ID « JPA Q&A





1. Filling ID with trigger.    forum.hibernate.org

Hello, I am having some issues when trying to let a trigger fill ID. Hibernate does not allow me to set id "nullable = true" (id does nothing), and there is no way to let Hibernate know that i will treat it at DB, so it can be NULL on ID. How can I do that? Can anyone help me? Code: ...

2. a posible solution for id generation with triggers    forum.hibernate.org

I have made a posible solution for id generation with triggers. I'm using Oracle 10g database, but this solution is quite simple in order to apply to other databases: simlpy use this class, transform trigger to a database function and map id generator class like this form: Mapping ====== MyFunctionWasPrevATrigger ...

3. a posible solution for id generation with triggers: enhanced    forum.hibernate.org

Mapping ====== MyFunctionWasPrevATrigger FunctionIdGenerator.java ================= import java.io.Serializable; import java.sql.CallableStatement; import java.sql.SQLException; import java.util.Properties; import org.hibernate.HibernateException; import org.hibernate.MappingException; import org.hibernate.dialect.Dialect; import org.hibernate.engine.SessionImplementor; import org.hibernate.exception.JDBCExceptionHelper; import org.hibernate.id.Configurable; import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.IdentifierGeneratorFactory; import org.hibernate.type.Type; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class FunctionIdGeneratorimplements IdentifierGenerator, Configurable { private static final Log log = LogFactory.getLog(FunctionIdGenerator.class); private String ...

4. Generating ID using Trigger    forum.hibernate.org

Newbie Joined: Thu Dec 09, 2004 7:41 am Posts: 4 Hi, I am trying to use a Trigger to generate the primary key to a simple table in association with Hibernate 3 on Oracle 10g. My code looks like the following: Code: Session hibSession = sessionFactory.openSession(); ...

5. Not able to retreive correct id from a table with trigger    forum.hibernate.org

Hi All I am inserting data to a table which has a trigger associated with it. The trigger inserts some data to a audit trail table. i am using the merge method to save my transient object. But the id (primary key) that i receive after save is not from the table to which i am inserting but it is the ...