Oracle Constraint Exceptions

ADD/ENABLE constraint exception like ORA-02437, ORA-02299 etc

Today while working on one assignment I came across situation where I have to enable a unique key constraint on the table which some one disabled and forget due to which many duplicate records get entered and started creating problem for the application.

Now challenge is to find out all those records there are ways to  find duplicates by writing some queries but this is easiest and faster way by using Oracle Exceptions table.

Continue reading “Oracle Constraint Exceptions”

Debugging Hibernate using Log4J Logs

People who work with Hibernate often want to see, what SQL it is prepairing behind the seen and how it is mapping in real for debug purpose. We can achieve this by enable log4j for Hibernate classes. This will give a detailed debug info.

If using log4j.properties, enter the below line at end:

### log JDBC bind parameters ###
log4j.logger.net.sf.hibernate.type=debug

### log prepared statement cache activity ###
log4j.logger.net.sf.hibernate.ps.PreparedStatementCache=debug

If using log4j XML file, enter below line before <root>:

<logger name="org.hibernate">
    <level value="debug"/>
</logger>

<logger name="org.hibernate.SQL">
    <level value="debug"/>
</logger>

<logger name="org.hibernate.type">
    <level value="debug"/>
</logger>

Happy Coding 🙂