Wednesday, October 17, 2012

Enable/Disable Constraints In an Oracle Database

Triggers
alter trigger <TGR_NAME> disable;
alter trigger <TGR_NAME> enable;

Primary Key
alter table <TABLE_NAME> disable  PRIMARY KEY;
alter table <TABLE_NAME> disable  CONSTRAINT <PK_NAME>;

alter table <TABLE_NAME> enable PRIMARY KEY;
alter table <TABLE_NAME> enable CONSTRAINT <PK_NAME>;


Foreign Key
alter table <TABLE_NAME> disable CONSTRAINT <FK_NAME>;
alter table <TABLE_NAME> enable CONSTRAINT <FK_NAME>;

Finding foreign key constraints in an Oracle database

SELECT   uc.constraint_name||CHR(10)
||      '('||ucc1.TABLE_NAME||'.'||ucc1.column_name||')' constraint_source
,       'REFERENCES'||CHR(10)
||      '('||ucc2.TABLE_NAME||'.'||ucc2.column_name||')' references_column
FROM     user_constraints uc
,        user_cons_columns ucc1
,        user_cons_columns ucc2
WHERE    uc.constraint_name = ucc1.constraint_name
AND      uc.r_constraint_name = ucc2.constraint_name
AND      ucc1.POSITION = ucc2.POSITION -- Correction for multiple column primary keys.
AND      uc.constraint_type = 'R'
ORDER BY ucc1.TABLE_NAME
,        uc.constraint_name;

Thursday, September 27, 2012

java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()

Cause:
weblogic and websphere are not able to load the hibernate3.x jar file from the provided WAR file. To resolve this issue , use the following solution
solution is:
Added the hibernate-jpa-2.0-api-1.0.0.Final.jar in the Following path
JAVA_HOME \jre\lib\ext
and also place same jar in  weblogic specific JRE\lib\ext folde