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

 

Monday, January 2, 2012

setting debug port in the Tomcat and weblogic

Tomcat
adding this stuff to your startup script so that you are always running tomcat in debug mode.
  1. Open the startup script in (your_tomcat_home)/bin (WIN: startup.bat, UNIX: startup.sh)
  2. Add the following lines at the first blank line in the file (around line 8)
    WIN:
    set JPDA_ADDRESS=8000
    set JPDA_TRANSPORT=dt_socket
    
    UNIX:
    export JPDA_ADDRESS=8000
    export JPDA_TRANSPORT=dt_socket
    
  3. Change the execute line at the end to include jpda start
    WIN:
    call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
    
    UNIX:
    exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"
    
  4. Run the startup script when starting tomcat to run tomcat in debug mode
Weblogic
    use the following points to enable the debug port
  1. go to the domain in the weblogic
  2. open the bin
  3. edit the setDomainEnv.sh
  4. past the JAVA_DEBUG="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8087,server=y,suspend=n -Djava.compiler=NONE"
  5. then execute the startWeblogic.sh