Posts

Smooks Entity Persistence Frameworks - Hibernate

With the new Smooks Persistence cartridge in Smooks 1.2, we can directly use several entity persistence frameworks from within Smooks (Hibernate, JPA etc). So in this blog post let's try out the Hibernate sample specified in here . Since smooks have given the basic configurations only, this blog post is going to assist the peolple who need full implementation. What we are going to do is process the following XML message and store the product information to a bean and persist the order information. input.xml ------------ <order> <ordernumber>1</ordernumber> <customer>123456</customer> <order-items> <order-item> <product>11</product> <quantity>2</quantity> </order-item> <order-item> <product>22</product> <quantity>7</quantity> </order-item> </order-items> </or...

A way to transform message content in between the client and the backend server - WSO2 Payload Factory Mediator

WSO2 ESB version - 4.0.3 WSO2 PayLoad Factory Mediator is for transforming or replacing message content in between the client and the backend server. Incomming message from client can be transformed by the Payload Factory mediator into the format expected by the service. Then the response message can be formatted into which is expected by the client. Each argument in the mediator configuration could be a static value or an XPath expression. When an expression is used, argument value is fetched at runtime by evaluating the provided XPath expression against the existing SOAP message. Also the format of the request or response message can be configured which is mapped with the arguments provided in order. For instance in the following the values for format parameters Code & Price will be assigned with values evaluated from args given in the specified order. <payloadFactory> <format> <m:checkpriceresponse xmlns:m="http://services.sam...

Manually install a maven dependency

execute the following command from the command line with the correct values for options. -Dfile option locates the downloaded jar file. Therefore make sure to specify the correct location or reach the jar location from the command line and execute the command. mvn install:install-file -DgroupId=ojdbc -DartifactId=ojdbc6 \ -Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true

How to add Maven dependency from a relative path referencing a local jar

When you want to add a dependency which is not stored in maven repositories to your project this is the way!! You can manually download it and include inside the project and refer it from the pom.xml through a relative path. This example assumes that you have downloaded and stored the jar inside ${project}/src/test/resources/lib.  <dependency> <groupId>ojdbc</groupId> <artifactId>ojdbc6</artifactId> <scope>system</scope> <version>6</version> <systemPath>${basedir}/src/test/resources/lib/ojdbc6.jar</systemPath> </dependency> Here we must specify the scope of the dependency  as 'system'. There is another way which is to manually install the maven dependency to your local repository. You can find out how from here .

Oracle Stored Procedure to return multiple records and call it in SQLPLUS

To return multiple records we need a REF CURSOR type variable to assign each record. The following is a script which return a REF CURSOR  as OUT parameter. --OracleStroredProc.sql CREATE OR REPLACE PACKAGE Types AS   TYPE cursor_type IS REF CURSOR; END Types; / ------- CREATE OR REPLACE PROCEDURE getEmployeeInfo(p_recordset1 OUT  Types.cursor_type) AS BEGIN     OPEN p_recordset1 FOR     SELECT empNumber, empName, phone, address FROM Employees;     END; / We can run the above script in SQLPLUS as below. SQL> START OracleStroredProc.sql So procedure will be created by now. To call the procedure we have to create a variable of type REFCURSOR and pass it as a parameter to procedure call. Then we can print the variable to see the result. SQL> var a REFCURSOR; SQL> call getEmployeeInfo(:a); Call completed. SQL> print :a;

Executing the Oracle PL/SQL returns a number?

When you execute a PL/SQL script through sqlplus, if it returns a number at each line you press enter for a new line, it is beacuse you have forgot to include '/' end of the script file for execute. ex: SQL> OracleScript.sql        > 34        > 35 So at this situation just enter '/'. Script will execute. SQL> OracleScript.sql        > 34 / If you don't want to manually enter '/' here, place a '/' end of the script file. The script in here has a '/' end of the file which tells to execute it.

Oracle change the default date format before insert data

Oracle accepts date in the default format of YYYY-MON-DD . Here month is accepted as three characters of month name. Ex: January-JAN, February: FEB, etc Now before executing a bulk records to a table with a required date format such as YYYY-MM-DD , we can alter the session to accept date in that format from the following query. SQL> alter session set NLS_DATE_FORMAT='YYYY-MM-DD'; Now we can insert records with date represented in YYYY-MM-DD format.