How can apply query in Hibenrate?

Hi !
I am using Hibenrate.and i need to know how to provide CRUD operation in Hibenrate.
I write the code for Inserting data in table.but when i want to read data there is a probs...
i have one table named book in My Sql server 5.0. in which id and bookname two fields are there...
now i have created 4 files...
1. Book.java (Entity beans)
2. book.hbm.xml (configuration beans with table in db)
3. IdIncrementExample.java (java file from which i am applying CRUD operation)
4. hibernate.cfg.xml (hibernate configuration)
Now the code is as follow.....
1. Book.java
public class Book {
private long lngBookId;
private String strBookName;
* @return Returns the lngBookId.
public long getLngBookId() {
return lngBookId;
* @param lngBookId The lngBookId to set.
public void setLngBookId(long lngBookId) {
this.lngBookId = lngBookId;
* @return Returns the strBookName.
public String getStrBookName() {
return strBookName;
* @param strBookName The strBookName to set.
public void setStrBookName(String strBookName) {
this.strBookName = strBookName;
2. book.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
     <class name="Book" table="book">
          <id name="lngBookId" type="long" column="id" >
<generator class="increment"/>
          </id>
          <property name="strBookName">
<column name="bookname" />
          </property>
     </class>
</hibernate-mapping>
3. hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="book.hbm.xml"/>
</session-factory>
</hibernate-configuration>
4. IdIncrementExample.java
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import java.io.*;
import org.hibernate.*;
import java.util.*;
* @author Administrator
public class IdIncrementExample {
public static void main(String[] args) {
Session session = null;
     DataInputStream din =new DataInputStream(System.in);
     String B_Name=new String();
     int B_No;
try{
// This step will read hibernate.cfg.xml and prepare hibernate for use
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
Transaction txsave = session.beginTransaction();
//Create new instance of Contact and set values in it by reading them from form object
System.out.println("Inserting Book object into database..");
Book book = new Book();
book.setStrBookName("Tutorial");
session.saveOrUpdate(book);
System.out.println("Book object persisted to the database.\n\n");
txsave.commit();
System.out.println(" Save Completed");
     Transaction txupdate = session.beginTransaction();
     System.out.print("Please Enter The Book No :: ");
          B_No = Integer.parseInt(din.readLine());
     String SQL_QUERY ="update Book set bookname= 'Hackers' where id= :va";
     // System.out.println("\n String is :: " + SQL_QUERY);
     int p= session.createQuery(SQL_QUERY)
.setString("va","6")
.executeUpdate();
     for(Iterator it=query.iterate();it.hasNext();)
          System.out.println("First");
          Book b1=(Book)it.next();
          System.out.println("ID: " + b1.getStrBookName());
          System.out.println("Name: " + b1.getStrBookName());
               book.setLngBookId(B_No);
          System.out.print("Please Enter The Book Name :: ");
          B_Name = din.readLine();
               book.setStrBookName(B_Name);
          session.saveOrUpdate(book);
          System.out.println("Book object persisted to the database.");
txupdate.commit();
session.close();
}catch(Exception e){
System.out.println(e.getMessage());
}finally{
and when i run this code at that time the following errors ill genrate.....
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Administrator\My Documents\Hibernate\build\classes
Note: C:\Documents and Settings\Administrator\My Documents\Hibernate\src\IdIncrementExample.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
compile:
run:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Inserting Book object into database..
Hibernate: select max(id) from book
Book object persisted to the database.
Hibernate: insert into book (bookname, id) values (?, ?)
Save Completed
5
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException
at org.hibernate.hql.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:35)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at IdIncrementExample.main(IdIncrementExample.java:58)
Please Enter The Book No ::
Java Result: 1
BUILD SUCCESSFUL (total time: 54 seconds)
I am using Netbeans 5.5
and the sql file which is....here...
SQLyog - Free MySQL GUI v5.15
Host - 5.0.24-community-nt : Database - test
Server version : 5.0.24-community-nt
SET NAMES utf8;
SET SQL_MODE='';
create database if not exists `test`;
USE `test`;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
/*Table structure for table `book` */
DROP TABLE IF EXISTS `book`;
CREATE TABLE `book` (
`id` int(5) NOT NULL,
`bookname` varchar(20) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `book` */
insert into `book` (`id`,`bookname`) values (1,'abc');
insert into `book` (`id`,`bookname`) values (2,'Hibernate Tutorial');
insert into `book` (`id`,`bookname`) values (3,'sds');
insert into `book` (`id`,`bookname`) values (4,'Hibernate Tutorial');
insert into `book` (`id`,`bookname`) values (5,'Tutorial');
insert into `book` (`id`,`bookname`) values (6,'Tutorial');
insert into `book` (`id`,`bookname`) values (7,'Tutorial');
insert into `book` (`id`,`bookname`) values (8,'Tutorial');
insert into `book` (`id`,`bookname`) values (9,'Tutorial');
insert into `book` (`id`,`bookname`) values (10,'Tutorial');
insert into `book` (`id`,`bookname`) values (11,'Tutorial');
insert into `book` (`id`,`bookname`) values (12,'Tutorial');
insert into `book` (`id`,`bookname`) values (13,'Tutorial');
insert into `book` (`id`,`bookname`) values (14,'Tutorial');
insert into `book` (`id`,`bookname`) values (15,'Tutorial');
insert into `book` (`id`,`bookname`) values (16,'Tutorial');
SET SQL_MODE=@OLD_SQL_MODE;
test is the database name......and book is the table name...
=======================================================
can any one help me......

I was kind of kidding as I've written one and therefore have a vested interest.
However, hibernate.org should be your first port of call.
The creators of Hibernate have written a tome called "Java Persistence with Hibernate" that I've not read, but which has good reviews so far. They also wrote "Hibernate In Action" which is good, but slightly out of date. I'd also say that that one's only so-so for beginners.
My book is Beginning Hibernate, which I think is good for (duh) beginners.
There are others, but I don't feel obliged to try and sell you them as the ones I've read are mediocre.
D.

Similar Messages

  • How can I query all the members of a group using querbuilder?  I cannot find any related properties

    How can I query all the members of a group using querbuilder?  I cannot find any related properties describing members under /home/groups/s/sample_group in jcr repository.

    Hi,
    FieldPoint Explorer is no longer used to configure FieldPoint systems. However, I do not think that the configuring your system in FieldPoint Explorer is causing the error.
    FieldPoint systems are now setup in Measurement and Automation Explorer (MAX).  Information on setting up FieldPoint systems in MAX can be found in the MAX help under: Installed Products>> FieldPoint. Also, I recommend upgrading to the latest FieldPoint driver and version of MAX.  The FieldPoint VI's will be slightly different when you upgrade, so there is a good chance that this will eliminate the error.
    Regards,
    Hal L.

  • How can I query data from XML file stored as a CLOB ?

    Hi folks,
    please see below sample of XML file, which is stored in "os_import_docs", column "document" as CLOB.
    I would like to query this XML file using some SQL select.
    How can I query data form below XML?
    <?xml version="1.0" encoding="UTF-8"?>
    <etd>
      <header>
        <AR>000000000</AR>
        <AW>0</AW>
        <CT>S</CT>
        <CU>H</CU>
        <CZ>SS48</CZ>
        <BU>4</BU>
        <CH>0032</CH>
        <CK>2012-11-01</CK>
        <CL>21:18</CL>
        <CW>225</CW>
        <CX>0</CX>
        <CF>SS-CZL18</CF>
        <DV>2</DV>
      </header>
      <account_group id="234">
        <account id="234">
          <invoice id="000742024">
            <da>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>A</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>88754515</BS>
              <AD>Mike Tyson</AD>
              <AC>Mike Tyson</AC>
              <AZ>CZ6521232465</AZ>
              <AE/>
              <CG>A</CG>
              <AL>A</AL>
              <BZ>.</BZ>
              <AH>Some street</AH>
              <AI/>
              <AF>Some city</AF>
              <AK>Kraj</AK>
              <AG>CZ</AG>
              <AJ>885 21</AJ>
              <CR>21-11-2012</CR>
              <AY>602718709</AY>
              <AV>800184965</AV>
              <AP/>
              <AO/>
              <AQ/>
              <AN/>
            </da>
            <da>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>A</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>88754515</BS>
              <AD>Mike Tyson</AD>
              <AC>Mike Tyson</AC>
              <AZ>CZ6521232465</AZ>
              <AE/>
              <CG>A</CG>
              <AL>L</AL>
              <BZ>Mike Tyson</BZ>
              <AH>Some street</AH>
              <AI/>
              <AF>Some city</AF>
              <AK>Kraj</AK>
              <AG>CZ</AG>
              <AJ>885 21</AJ>
              <CR>21-11-2012</CR>
              <AY/>
              <AV>800184965</AV>
              <AP/>
              <AO/>
              <AQ/>
              <AN/>
            </da>
            <detaildc CH="0032" AB="234" BS="11888954" BB="32" BA="CZ" AT="" CI="7077329000002340342" AU="" DU="1Z48395" CB="CZK">
              <dc>
                <AW>0</AW>
                <CT>D</CT>
                <CU>C</CU>
                <BY>31-10-2012</BY>
                <CA>25-10-2012</CA>
                <CV>8151</CV>
                <BT>12111</BT>
                <CJ>1</CJ>
                <AM>0</AM>
                <DR>PC</DR>
                <DS/>
                <DO>25-10-2012</DO>
                <DQ>18:42</DQ>
                <CE>1</CE>
                <BH>8151</BH>
                <CY>8151 SHELL MALKOVICE P</CY>
                <DP>049336</DP>
                <DT/>
                <BQ/>
                <BR>500000</BR>
                <CN>30</CN>
                <CM>030</CM>
                <BO>160,00</BO>
                <BF>38,900</BF>
                <BC>6224,00</BC>
                <BI>32,417</BI>
                <CD>B</CD>
                <BG>0,600</BG>
                <BK>31,817</BK>
                <BJ>0,000</BJ>
                <DI>8</DI>
                <BP>20,00%</BP>
                <CC>CZK</CC>
                <BM>5090,67</BM>
                <BN>1018,13</BN>
                <BL>6108,80</BL>
                <BD>5090,67</BD>
                <BE>1018,13</BE>
                <DW>6108,80</DW>
                <CO>Nafta</CO>
              </dc>
            </detaildc>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>1</DG>
              <CN>30</CN>
              <CM>030</CM>
              <DF>160,00</DF>
              <DH>litr</DH>
              <DJ>20,00%</DJ>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA>P</DA>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>2</DG>
              <CN/>
              <CM/>
              <DF>160,00</DF>
              <DH>litr</DH>
              <DJ/>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA/>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>19</DG>
              <CN/>
              <CM/>
              <DF/>
              <DH/>
              <DJ/>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA/>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>8</DG>
              <CN/>
              <CM/>
              <DF/>
              <DH/>
              <DJ/>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA/>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
          </invoice>
        </account>
      </account_group>
      <footer>
        <AR>999999999</AR>
        <AW>0</AW>
        <CT>S</CT>
        <CU>T</CU>
        <CZ>SS48</CZ>
        <BU>4</BU>
        <CH>0032</CH>
        <CK>2012-11-01</CK>
        <CL>23:04</CL>
        <CW>225</CW>
        <BX>1</BX>
        <CS>7</CS>
        <BW>0000000000000610880</BW>
      </footer>
    </etd>sample - not working:
        select  x.*
        from os_import_docs d
             ,XMLTABLE('/etd/header'
                        PASSING httpuritype(d.document).getXML()
                        COLUMNS
                           response_status varchar2(50) PATH 'AR'
                        )  x
       where d.object_id = 2587058
         and rownum = 1; 
    ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 6196, maximum: 4000)Many thanks,
    Tomas

    Hello,
    many thanks for the reply. Your examples are very usefull for me.
    To answer your questions.
    An XML structure:
    /etd
        /header - repeat in each row in output
        /account_group/account
            /invoice
                /da - repeat for each details under "selected "invoice
                /detaildc/dc - the lowest level 
                /detaildn/dn - the lowest level 
                /dt - repeat for each details under "selected "invoice
        /footer - repeat in each row in outputI would like to to have a 1 row for each "record" in /detaildc section and include related nodes at higher levels.
    Please see below XML file, which is simplified file of example in first post, but includes a complete xml structure which needs to be queried in db.
    <?xml version="1.0" encoding="UTF-8"?>
    <etd>
      <header>
        <AR>000000000</AR>
        <CK>2012-10-31</CK>
        <CF>SS-CZL19</CF>
      </header>
      <account_group id="234">
        <account id="234">
          <invoice id="EI08P4000">
            <da>
              <AR>EI08P4000</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildc DU="1Z56655" CB="EUR">
              <dc>
                <DO>16-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>1940,60</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="2Z55050" CB="EUR">
              <dc>
                <DO>17-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>1328,10</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="2Z90001" CB="EUR">
              <dc>
                <DO>27-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>185,10</BM>
                <CO>Poplatek</CO>
              </dc>
            </detaildc>
            <dt>
              <AR>EI08P4000</AR>
              <DG>8</DG>
            </dt>
          </invoice>
        </account>
        <account id="234">
          <invoice id="EI13T7777">
            <da>
              <AR>EI13T7777</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildc DU="1Z48302" CB="EUR">
              <dc>
                <DO>26-10-2012</DO>
                <CY>SANEF 07706 A 07704</CY>
                <BM>232,10</BM>
                <CO>Dalnicni poplatek</CO>
              </dc>
            </detaildc> 
            <detaildc DU="1Z48302" CB="EUR">
              <dc>
                <DO>20-10-2012</DO>
                <CY>TEST A 07704</CY>
                <BM>30,10</BM>
                <CO>Poplatek</CO>
              </dc>
            </detaildc>       
            <dt>
              <AR>EI13T7777</AR>
              <DG>8</DG>         
            </dt>
          </invoice>
        </account>
        <account id="234">
          <invoice id="EI327744">
            <da>
              <AR>EI327744</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildn  CI="707732 00000234" >
              <dn>
                <BY>30-10-2012</BY>
                <BM>8,10</BM>
              </dn>
            </detaildn>
            <detaildn CI="707732 00000234" >
              <dn>
                <BY>30-10-2012</BY>
                <BM>399,50</BM>
              </dn>
            </detaildn>
            <dt>
              <AR>EI327744</AR>
            </dt>
          </invoice>
        </account>
        <account id="234">
          <invoice id="EI349515">
            <da>
              <AR>EI349515</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildc DU="1Z56514" CB="EUR">
              <dc>
                <DO>29-10-2012</DO>
                <CY>ALLAMI AUTOPALYAKEZE</CY>
                <BM>1240,60</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="1Z56515" CB="EUR">
              <dc>
                <DO>19-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>7428,10</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="1Z56515" CB="EUR">
              <dc>
                <DO>12-10-2012</DO>
                <CY>UK</CY>
                <BM>954,10</BM>
                <CO>Poplatek</CO>
              </dc>
            </detaildc>
            <dt>
              <AR>EI349515</AR>
              <DG>8</DG>
            </dt>
          </invoice>
        </account>
      </account_group>
      <footer>
        <CZ>SS47</CZ>
        <BU>4</BU>
        <CH>0032</CH>
        <CK>2012-10-31</CK>
        <CL>01:25</CL>
      </footer>
    </etd>Expected output
    AR     CK     CF             AR4             AD             DU     CB     DO             CY                     BM      CO                AR5             DG     CI             BY               BM6     CZ     BU       CH       CK7    CL
    0     41213     SS-CZL19     EI08P4000     Mickey Mouse     1Z56655     EUR     16-10-2012     ASFINAG POST_MAUT     1940,60     Dalnicni znamka        EI08P4000     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI08P4000     Mickey Mouse     2Z55050     EUR     17-10-2012     ASFINAG POST_MAUT     1328,10     Dalnicni znamka        EI08P4000     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI08P4000     Mickey Mouse     2Z90001     EUR     27-10-2012     ASFINAG POST_MAUT      185,10     Poplatek        EI08P4000     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI13T7777     Mickey Mouse     1Z48302     EUR     26-10-2012     SANEF 07706 A 07704      232,10     Dalnicni poplatek  EI13T7777     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI13T7777     Mickey Mouse     1Z48302     EUR     20-10-2012     TEST A 07704               30,10     Poplatek        EI13T7777     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI327744     Mickey Mouse                                                                      EI327744          707732 00000234     30-10-2012     8,10     SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI327744     Mickey Mouse                                                                      EI327744          707732 00000234     30-10-2012     399,50     SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI349515     Mickey Mouse     1Z56514     EUR     29-10-2012     ALLAMI AUTOPALYAKEZE     1240,60     Dalnicni znamka        EI349515     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI349515     Mickey Mouse     1Z56515     EUR     19-10-2012     ASFINAG POST_MAUT     7428,10     Dalnicni znamka        EI349515     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI349515     Mickey Mouse     1Z56515     EUR     12-10-2012     UK                      954,10     Poplatek        EI349515     8                                    SS47     4     32     41213     01:25

  • How can this query avoid full table scans?

    It is difficult to avoid full table scans in the following query because the values of column STATUS reiterant numbers. There are only 10 numbers values for the STATUS column (1..10)
    But the table is very large. there are more than 1 million rows in it. A full table scanning consumes too much time.
    How can this query avoid full table scans?
    Thank you
    SELECT SYNC,CUS_ID INTO V_SYNC,V_CUS_ID FROM CONSUMER_MSG_IDX
                      WHERE CUS_ID = V_TYPE_CUS_HEADER.CUS_ID AND
                            ADDRESS_ID = V_TYPE_CUS_HEADER.ADDRESS_ID AND
                            STATUS =! 8;Edited by: junez on Jul 23, 2009 7:30 PM

    Your code had an extra AND. I also replaced the "not equal" operator, which has display problems with the forum software
    SELECT SYNC,CUS_ID
       INTO V_SYNC,V_CUS_ID
      FROM CONSUMER_MSG_IDX
    WHERE CUS_ID = V_TYPE_CUS_HEADER.CUS_ID AND
           ADDRESS_ID = V_TYPE_CUS_HEADER.ADDRESS_ID AND
           STATUS != 8;Are you sure this query is doing a table scan? Is there an index on CUS_ID, ADDRESS_ID? I would think that would be mostly unique. So I'm not sure why you think the STATUS column is causing problems. It would seem to just be a non-selective additional filter.
    Justin

  • DBMS_SCHEDULER: How can I query a job's log history?

    Hi,
    How can I query a job's log history?
    Thanks,
    Alan

    Hi
    The table user_scheduler_job_run_details contains info about your job
    Sushant

  • How can apply Oracle BPEL patch to Oracle BPEL Process manager??

    Hi, Gurus:
    I am new to Oracle BPEL Process manager, I successfully install Oracle BPEL Process manager, but I need to install Oracle BPEL patch and the examples within it.
    so I download bpelpatches.zip, it has over 106 MB.
    It contains:
    1. p4369818_101200_GENERIC.zip
    2. p4343748_101200_GENERIC.zip
    3. p4406640_101200_GENERIC_Patch01.zip
    4. p4469111_101200_GENERIC_Patch02.zip
    I am using window XP, how Can I apply these patches to my system??
    How can apply Oracle BPEL patch to Oracle BPEL Process manager??
    Thanks a lot!!
    Charlie

    don't see any invoke in your client against the intiate operation.. - which creates the correlation
    only 2 of them
    <invoke name="Invoke_1" partnerLink="PartnerLink_1" portType="ns1:CorrelatedBPELProcess" operation="receive1" inputVariable="Invoke_1_receive1_InputVariable"/>
    <invoke name="Invoke_2" partnerLink="PartnerLink_1" portType="ns1:CorrelatedBPELProcess" operation="receive2" inputVariable="Invoke_2_receive2_InputVariable"/>
    compared to this def of the process
    <portType name="CorrelatedBPELProcess">
    <operation name="initiate">
    <input message="client:CorrelatedBPELProcessRequestMessage"/>
    </operation>
    <operation name="receive1">
    <input message="client:CorrelatedBPELProcessRequestMessage"/>
    </operation>
    <operation name="receive2">
    <input message="client:CorrelatedBPELProcessRequestMessage"/>
    </operation>
    </portType>

  • How can I query on a time field??

    Hi All,
    I have a time field (base table field) in my form. I use a format mask of HH24:MI for that field.
    If i put in "%10:00" in that field and query, the query returns rows correctly. But I canot ask my user to put in a "%" each time he/she queries. I have to do it from the form.....
    How can I do this programatically..I mean how do I write it in pre-query?
    Thanks in advance...
    Sowmya.

    Hi,
    Thanks for your reply...
    Unfortunately I already tried that..
    The problem was to compare only the time portions . And as soon as the user put in say "12:00" in the time field, the system defaulted it to 01-SEP-2002 12:00:00 .And it compared this to the database value which is wrong...
    I solved the problem by creating a non-base table item and then writing code in pre-query using set_block_property etc...and it worked !!
    Thanks for you response once again..
    Sowmya.
    How about using the Set_block_property(Default_where) built in? check the online help.

  • How can apply configure file in ssis by using script task ?

    I had  two config file in ssis
     1. config file as per QA
    2. config file as per Production
     I think apply dynamically by using script task for above file (acc to server)
    How can I apply in script task for config file path in C# script
    any one provide Helpful code ??
    Thanks

    I applied script Task  with below code :
    public void Main()
    //User::Config,User::Config_Pd,User::Config_QA
    Application App = new Application();
    Package Pack = new Package();
    DTSExecResult pkgResults;
    string strPackageName;
    string filename = "";
    string configvalue;
    configvalue = Dts.Variables["Config"].Value.ToString();
    strPackageName = Directory.GetCurrentDirectory().ToString() + "\\Excel Reports from Remittance advice\\Child.dtsx";
    try
    Pack = App.LoadPackage(strPackageName, null);
    if (Pack != null)
    if (configvalue == "DEV")
    filename = Dts.Variables["Config_QA"].Value.ToString();
    else if (configvalue == "PROD")
    filename = Dts.Variables["Config_Pd"].Value.ToString();
    else
    Dts.TaskResult = (int)ScriptResults.Failure;
    System.Windows.Forms.MessageBox.Show("Unable to bind the XML Configurations");
    return;
    } System.Windows.Forms.MessageBox.Show("Config:"+filename);
    Pack.ImportConfigurationFile(@filename);
    Pack.EnableConfigurations = true;
    Pack.Configurations.Add();
    App.SaveToXml(strPackageName, Pack, null)
    pkgResults = Pack.Execute(); //Pack.Execute();
    System.Windows.Forms.MessageBox.Show("Results:" + pkgResults.ToString());
    Dts.TaskResult = (int)ScriptResults.Success;
    But ouput in ssis showing as
    But some thing missed in code  plz help me ...

  • How can i query datetime from DB?

    i want to use 'like' to query the records in one year or in one month
    for example, i want to know how many records in month 11
    how can i do?
    please help me
    thanks.
    the type is date

    If your date is indexed it would be better to use:
    fl_date between '01-nov-02' and '30-nov-02'
    To achieve that with one parameter you could use:
    fl_date between '&param' and last_day('&&param')
    If your dates have time elements you need an extra day minus one second:
    fl_date between '&param' and add_months('&&param',1) - (1/(60*60*24))

  • How can I query a table based on row numbers?

    select numberofmonths  from traveldays_president where row_number= 55;
    How can I go about filtering records based on row number?

    Use a query like
    select numberofmonths from traveldays_president where row_number=@rownumber
    Create a dataset with above query in SSRS and on refreshing it after execution SSRS will add field information and parameter information for you. Then when you try to run report it will ask you for value of rownumber and based on value you pass it will give
    you corresponding row(s) in output
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How can i query report between date item

    Hi All,
    my report query like this
    </code>
    SELECT PROJECT_STATEMENT.PROJECT_STATEMENT_ID,
    PROJECT_STATEMENT.CREATE_DATE,
    PROJECT_STATEMENT.DOC_NO,
    PROJECT_STATEMENT.LISTS
    FROM PROJECT_STATEMENT
    WHERE TO_CHAR(PROJECT_STATEMENT.CREATE_DATE) BETWEEN TO_CHAR(:P3341_START_DATE)AND TO_CHAR(:P3341_TO_DATE)
    AND PROJECT_STATEMENT.CATEGORY_BUDGET = 2
    AND PROJECT_STATEMENT.STATUS = 1
    AND PROJECT_STATEMENT.BUDGET_TYPE = 8
    </code>
    i try to select date from 2 item is start date and stop date with this query but it does't work how can i do this? please help me...
    my APEX Version is 4.1 and oracle 11g
    Edited by: 963456 on 5 ต.ค. 2555, 8:11 น.

    Hi,
    Try this
    SELECT PROJECT_STATEMENT.PROJECT_STATEMENT_ID,
      PROJECT_STATEMENT.CREATE_DATE,
      PROJECT_STATEMENT.DOC_NO,
      PROJECT_STATEMENT.LISTS
    FROM PROJECT_STATEMENT
    WHERE PROJECT_STATEMENT.CREATE_DATE  BETWEEN TO_DATE(:P3341_START_DATE,'<fmt>')
      AND TO_DATE(:P3341_TO_DATE,'<fmt>')
    AND PROJECT_STATEMENT.CATEGORY_BUDGET = 2
    AND PROJECT_STATEMENT.STATUS = 1
    AND PROJECT_STATEMENT.BUDGET_TYPE = 8Where &lt;fmt&gt; is the Date Format Mask of the two page items.
    Converting dates to varchar2 and then comparing them is not the way to do it.
    Cheers,

  • HOW CAN APPLY FREE GOOD 4 PRICING PROCEDURE?

    TELL ME SIR HOW CAN APPY FREE GOOD 4 PRICING PROCEDURE?

    Hi Pradeep
    1.Run trans. VBN2 to first create master record for free goods as follows:
    Enter following information in selection screen:
    - Free goods type: NA00
    - Sales org, distribution channel, customer # and execute.
    Now in next screen create the record as follows:
    - First select the exclusive button and verify that you are in exclusive view. 
      (that is if you want exclusive)
    - Material#, Min qty - Say 34 cartons. (check in what units you want to manage)
      From: 34 cartons
      unit of measure: 
      Free goods: 12 Pcs
      Unit of measure: Pcs
      Calcualtion type: 1 or try the other options
      Deliver control: Blank or any of the other options suitable to you.
    Now save and exit.
    Now run VA01 for 34 cartons and press enter. The system will automatically propose the free goods 
    item at no additional charge. Try higher order qtys and see if the free goods qty are scaling up. 
    If not adjust the calculation parameters in the master record screen
    It should be transaction VBN1. Sorry for the error. 
    VBN2 is to change the record. VBN1 creates it.
    If you want to give free goods to some of the customers than
    1. create a customer group say 99 for FREE GOODS
    In Free Goods Menu:
    2. add a feild catalog for CUSTOMER GROUP
    3. create a condition table (free goods) say 555 only for customer group
    4. create a sequence say FREE with condition table 555
    5. create a condition type say FREE with
    6. maintain pricing procedure say ZFREE with condition type FREE
    Now assign:
    7. Active Free goods Determination or Assign with your sales organisation this procedure ZFREE
    8. Create free goods determination with transaction code /nvbn1 for FREE with Key Csuomer Group 
    99 for exclusive
    Give customer Group say 99 and from 34 to 34 free 12
    Thanks
    G. Lakshmipathi

  • How can I query and retrieve like that?

    Hi all!
    When I read the tuning document of company, I found that some retrieved information about storages and machine. Because this forum does not allow to post message with attach file, so I demonstrate like that:
    Disk Device Disk Utilization (%) Disk Reads (per second) Disk Writes (per second) ...
    C: 0.02 0.0024 1.46
    Where and how can I retrieve this record? What dynamic view do I retrieve?
    Thanks any way

    SQL> r
    1 select substr(NAME,1,4),
    2 sum(PHYRDS) "Physical Reads",
    3 sum(round((PHYRDS / PD.PHYS_READS)*100,2)) "Read %",
    4 sum(PHYWRTS) "Physical Writes",
    5 sum(round(PHYWRTS * 100 / PD.PHYS_WRTS,2)) "Write %",
    6 sum(fs.PHYBLKRD+FS.PHYBLKWRT) "Total Block I/O's"
    7 from (
    8 select sum(PHYRDS) PHYS_READS,
    9 sum(PHYWRTS) PHYS_WRTS
    10 from v$filestat
    11 ) pd,
    12 v$datafile df,
    13 v$filestat fs
    14 where df.FILE# = fs.FILE#
    15* group by substr(name,1,4)
    SUBS Physical Reads Read % Physical Writes Write % Total Block I/O's
    /u01 9424 99.29 11093 94.17 33569
    /u02 0 0 7 .06 7
    /u03 68 .72 680 5.77 939

  • How can i store latitude and longitude (of registered user locations) in sql server and how can i query it for finding locations inside X radius from point y (or any user)?

    Hello
    In my app (WP 8.1) i have to store user location (lat,lon) in sql db so how can i store that location detail? And i also have to find all the location which are inside certain radius X from another user location, How can i do this?
    Any Sample project or code or any blog post?
    P.S. I use sql server 2012.

    If you need to do spatial queries like the one you mentioned you'd need to store it as a spatial geography type. For points, a simple SQL INSERT statement using the Point() method would do it. Example here:
    http://msdn.microsoft.com/en-us/library/bb933811.aspx For locations inside a radius, you'd use STDistance() method. All of the methods for the geography data type are documented here:
    http://msdn.microsoft.com/en-us/library/bb933802.aspx and can be used in ordinary T-SQL statements.
    If you need to use the SQL Server spatial library in your .NET application direct, Alastair has some nice blog posts, like this one:
    https://alastaira.wordpress.com/2011/08/19/spatial-applications-in-windows-azure-redux-including-denali/ , he even wrote a book. Or search the answers in this forum.
    Hope this helps, Bob

  • How can i query an apple device's information?

    hi,
    i am a newcomer developer,i am now on a App project about the apple device,we think the corrct information of a device is vital, so our new App will ask user to enter the device id like "DLXFH......",then comes the problem, how can our new App get the information of the device ,like produced time, memory size, ,,,,?any one replied?

    You can't get that information.
    You can discover what type of capabilities the device has (camera, microphone, etc.).

Maybe you are looking for

  • Datatype change in RTF template

    Hi Team, I am not sure if this can be done, but, do we have a way in which we can change the datatype of a column in rtf template while preparing the template. Can you please help! Thanks Bhupendra Edited by: Bhupendra Gupta on Sep 9, 2009 4:21 AM

  • How can I tell if my cluster is working?

    This seems like a question I should know the answer to, but I set up a quickcluster and can't tell if both machines are actually processing the job or if only one machine is. In the old version of compressor, I had qmaster in the bar which turned gre

  • Links in PDF don't work on Mac conversion?

    I am working with Word 2011 on a Mac. My document has linked TOC and many internal links and cross references. When I convert to PDF, NONE of the work, whether I use "Save As PDF," Distiller, or Acrobat XI Pro... Is this a known limitation? Is there

  • Rebate agreement with customer hierarchy

    Hi, I want to use customer hierarchy for customer rebates where in the accrual rate with scales shall be maintained only the high level customer. Invoice values of all the subordinate customers should e accrued using this rebate agreement. Have learn

  • Print Problems / Colors are off - mixing colors / grainy/ banding

    Printer is set up with ICC profile and uses RGB mode.  Printed colors are extremely off - tons of white spots / lines / smudge marks in the ink & the colors seems to be mixing.  High res images are printing out extremely pixelated.  Using Ricoh sg311