-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Multiple rows returned, all duplicates of the first row
PostPosted: Fri Apr 05, 2013 3:49 pm 
Newbie

Joined: Fri Apr 05, 2013 3:28 pm
Posts: 9
The problem is, that when I run a query, I get the proper number of rows, but they are all for the first record. Why am I not able to see values from all rows? The database table definitely has 23 different rows of different data.

Anything I can supply/do to debug? Thanks!

I have the following components:

Code:
package com.nimsoft.ca.search;
import java.sql.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.DateBridge;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Resolution;
import org.hibernate.search.annotations.Store;

/**
* The persistent class for the best_practices__kav database table.
*
*/
@Entity
@Indexed
@Table(name = "best_practices__kav")
public class BestPractices {
    private char id;
    private String articletype;
    private Date firstpublisheddate;
    private Date lastpublisheddate;
    private Date lastmodifieddate;
    private String articlenumber;
    private String title;
    private String summary;
    private String best_practices__c;
   

    public BestPractices() {

    }

    public BestPractices(char id, String articletype, Date firstpublisheddate, Date lastpublisheddate, Date lastmodifieddate, String articlenumber, String title, String summary, String best_practices__c) {
        this.id = id;
        this.articletype = articletype;
        this.firstpublisheddate = firstpublisheddate;
        this.lastpublisheddate = lastpublisheddate;
        this.lastmodifieddate = lastmodifieddate;
        this.articlenumber = articlenumber;
        this.title = title;
        this.summary = summary;
        this.best_practices__c = best_practices__c;
    }
       

    @Id
    @Field(index = Index.NO, analyze = Analyze.NO, store = Store.YES)
    public char getId() {
        return this.id;
    }

    public void setId(char id) {
        this.id = id;
    }
   
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
    public String getArticleType() {
        return this.articletype;
    }

    public void setArticleType(String articletype) {
        this.articletype = articletype;
    }
   
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
    public String getArticleNumber() {
        return this.articlenumber;
    }

    public void setArticleNumber(String articlenumber) {
        this.articlenumber = articlenumber;
    }
    @Field(index = Index.NO, analyze = Analyze.NO, store = Store.YES)
    @DateBridge(resolution=Resolution.MINUTE)
    public Date getFirstPublishedDate() {
        return firstpublisheddate;
    }

    public void setFirstPublishedDate(Date firstpublisheddate) {
        this.firstpublisheddate = firstpublisheddate;
    }
    @Field(index = Index.NO, analyze = Analyze.NO, store = Store.YES)
    @DateBridge(resolution=Resolution.MINUTE)
    public Date getLastPublishedDate() {
        return lastpublisheddate;
    }

    public void setLastPublishedDate(Date lastpublisheddate) {
        this.lastpublisheddate = lastpublisheddate;
    }
    @Field(index = Index.NO, analyze = Analyze.NO, store = Store.YES)
    @DateBridge(resolution=Resolution.MINUTE)
    public Date getLastModifiedDate() {
        return lastmodifieddate;
    }

    public void setLastModifiedDate(Date lastmodifieddate) {
        this.lastmodifieddate = lastmodifieddate;
    }
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
    public String getTitle() {
        return this.title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
    public String getSummary() {
        return this.summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
    public String getBest_Practices__c() {
        return this.best_practices__c;
    }

    public void setBest_Practices__c(String best_practices__c) {
        this.best_practices__c = best_practices__c;
    }


   
}

Code:
import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.search.FullTextSession;
import org.hibernate.search.Search;
import org.hibernate.search.query.dsl.QueryBuilder;


public class App {
     
    private static void doIndex() throws InterruptedException {
        Session session = HibernateUtil.getSession();
         
        FullTextSession fullTextSession = Search.getFullTextSession(session);
        fullTextSession.createIndexer().startAndWait();
         
        fullTextSession.close();
    }
     
    private static List<BestPractices> search(String queryString) {
        Session session = HibernateUtil.getSession();
        FullTextSession fullTextSession = Search.getFullTextSession(session);
         
        QueryBuilder queryBuilder = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(BestPractices.class).get();
        org.apache.lucene.search.Query luceneQuery = queryBuilder.keyword().onFields("title").matching(queryString).createQuery();

        // wrap Lucene query in a javax.persistence.Query
        org.hibernate.Query fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery, BestPractices.class);
         
        @SuppressWarnings("unchecked")
      List<BestPractices> bestPracticesList = fullTextQuery.list();
         
        fullTextSession.close();
         
        return bestPracticesList;
    }
     
    private static void displayBestPracticesTableData() {
        Session session = null;
         
        try {
            session = HibernateUtil.getSession();
             
           
             
          /*  List<BestPractices> bps = session.createQuery("from BestPractices").list();
               for ( BestPractices bp : bps ) {
                   System.out.println(bp.getSummary()); 
               }*/
           
            Query query = session.createQuery("from BestPractices").setMaxResults(25);
           // .setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
            List l = query.list();
            Iterator i1 = l.iterator();

            BestPractices bp = null;
            while (i1.hasNext()) {
                bp = (BestPractices)i1.next();
                System.out.println(bp.getArticleNumber());
            }
           
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally{
            if(session != null) {
                session.close();
            }
        }
    }
     
    public static void main(String[] args) throws InterruptedException {
        System.out.println("\n\n******Data stored in Best_Practices__KAV table******\n");
        displayBestPracticesTableData();
         
        // Create an initial Lucene index for the data already present in the database
        doIndex();
         
        Scanner scanner = new Scanner(System.in);
        String consoleInput = null;
         
        while (true) {
            // Prompt the user to enter query string
            System.out.print("\n\nEnter search key (To exit type 'X')");           
            consoleInput = scanner.nextLine();
             
            if("X".equalsIgnoreCase(consoleInput)) {
                System.out.println("End");
                System.exit(0);
            } 
             
            List<BestPractices> result = search(consoleInput);           
            System.out.println("\n\n>>>>>>Record found for '" + consoleInput + "'");
             
            for (BestPractices bestPractices : result) {
                System.out.println(bestPractices);
            }             
        } 
       
    }
}


Output is as follows:



******Data stored in Best_Practices__KAV table******

13:11:47,102 INFO Version:37 - HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
13:11:47,119 INFO Version:41 - HHH000412: Hibernate Core {4.2.0.Final}
13:11:47,134 INFO Environment:239 - HHH000206: hibernate.properties not found
13:11:47,134 INFO Environment:342 - HHH000021: Bytecode provider name : javassist
13:11:47,197 INFO Configuration:1933 - HHH000043: Configuring from resource: /hibernate.cfg.xml
13:11:47,197 INFO Configuration:1952 - HHH000040: Configuration resource: /hibernate.cfg.xml
13:11:47,447 INFO Configuration:2074 - HHH000041: Configured SessionFactory: null
13:11:48,087 INFO DriverManagerConnectionProviderImpl:98 - HHH000402: Using Hibernate built-in connection pool (not for production use!)
13:11:48,291 INFO DriverManagerConnectionProviderImpl:134 - HHH000115: Hibernate connection pool size: 20
13:11:48,291 INFO DriverManagerConnectionProviderImpl:137 - HHH000006: Autocommit mode: false
13:11:48,291 INFO DriverManagerConnectionProviderImpl:151 - HHH000401: using driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] at URL [jdbc:sqlserver://138.42.135.63;databaseName=Salesforce Backups;]
13:11:48,291 INFO DriverManagerConnectionProviderImpl:156 - HHH000046: Connection properties: {user=sa, password=****}
13:11:49,213 INFO Dialect:128 - HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
13:11:49,307 INFO TransactionFactoryInitiator:68 - HHH000399: Using default transaction strategy (direct JDBC transactions)
13:11:49,448 INFO ASTQueryTranslatorFactory:48 - HHH000397: Using ASTQueryTranslatorFactory
13:11:49,558 INFO Version:39 - HSEARCH000034: Hibernate Search 4.2.0.Final
13:11:49,730 WARN ConfigContext:301 - HSEARCH000075: Configuration setting hibernate.search.lucene_version was not specified, using LUCENE_CURRENT.
13:11:50,667 DEBUG QueryTranslatorImpl:265 - parse() - HQL: from com.nimsoft.ca.search.BestPractices
13:11:50,700 DEBUG QueryTranslatorImpl:283 - --- HQL AST ---
\-[QUERY] Node: 'query'
\-[SELECT_FROM] Node: 'SELECT_FROM'
\-[FROM] Node: 'from'
\-[RANGE] Node: 'RANGE'
\-[DOT] Node: '.'
+-[DOT] Node: '.'
| +-[DOT] Node: '.'
| | +-[DOT] Node: '.'
| | | +-[IDENT] Node: 'com'
| | | \-[IDENT] Node: 'nimsoft'
| | \-[IDENT] Node: 'ca'
| \-[IDENT] Node: 'search'
\-[IDENT] Node: 'BestPractices'

13:11:50,701 DEBUG ErrorCounter:82 - throwQueryException() : no errors
13:11:50,926 DEBUG FromElement:157 - FromClause{level=1} : com.nimsoft.ca.search.BestPractices (<no alias>) -> bestpracti0_
13:11:50,926 DEBUG HqlSqlWalker:629 - processQuery() : ( SELECT ( FromClause{level=1} best_practices__kav bestpracti0_ ) )
13:11:50,926 DEBUG HqlSqlWalker:869 - Derived SELECT clause created.
13:11:50,942 DEBUG JoinProcessor:175 - Using FROM fragment [best_practices__kav bestpracti0_]
13:11:50,942 DEBUG QueryTranslatorImpl:252 - --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (best_practices__kav)
+-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
| +-[SELECT_EXPR] SelectExpressionImpl: 'bestpracti0_.id as id1_0_' {FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=best_practices__kav,tableAlias=bestpracti0_,origin=null,columns={,className=com.nimsoft.ca.search.BestPractices}}}
| \-[SQL_TOKEN] SqlFragment: 'bestpracti0_.articleNumber as articleN2_0_, bestpracti0_.articleType as articleT3_0_, bestpracti0_.best_Practices__c as best4_0_, bestpracti0_.firstPublishedDate as firstPub5_0_, bestpracti0_.lastModifiedDate as lastModi6_0_, bestpracti0_.lastPublishedDate as lastPubl7_0_, bestpracti0_.summary as summary8_0_, bestpracti0_.title as title9_0_'
\-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[], fromElementByTableAlias=[bestpracti0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
\-[FROM_FRAGMENT] FromElement: 'best_practices__kav bestpracti0_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=best_practices__kav,tableAlias=bestpracti0_,origin=null,columns={,className=com.nimsoft.ca.search.BestPractices}}

13:11:50,942 DEBUG ErrorCounter:82 - throwQueryException() : no errors
13:11:50,958 DEBUG QueryTranslatorImpl:235 - HQL: from com.nimsoft.ca.search.BestPractices
13:11:50,958 DEBUG QueryTranslatorImpl:236 - SQL: select bestpracti0_.id as id1_0_, bestpracti0_.articleNumber as articleN2_0_, bestpracti0_.articleType as articleT3_0_, bestpracti0_.best_Practices__c as best4_0_, bestpracti0_.firstPublishedDate as firstPub5_0_, bestpracti0_.lastModifiedDate as lastModi6_0_, bestpracti0_.lastPublishedDate as lastPubl7_0_, bestpracti0_.summary as summary8_0_, bestpracti0_.title as title9_0_ from best_practices__kav bestpracti0_
13:11:50,958 DEBUG ErrorCounter:82 - throwQueryException() : no errors
13:11:50,989 DEBUG SQL:104 - select top 25 bestpracti0_.id as id1_0_, bestpracti0_.articleNumber as articleN2_0_, bestpracti0_.articleType as articleT3_0_, bestpracti0_.best_Practices__c as best4_0_, bestpracti0_.firstPublishedDate as firstPub5_0_, bestpracti0_.lastModifiedDate as lastModi6_0_, bestpracti0_.lastPublishedDate as lastPubl7_0_, bestpracti0_.summary as summary8_0_, bestpracti0_.title as title9_0_ from best_practices__kav bestpracti0_
Hibernate: select top 25 bestpracti0_.id as id1_0_, bestpracti0_.articleNumber as articleN2_0_, bestpracti0_.articleType as articleT3_0_, bestpracti0_.best_Practices__c as best4_0_, bestpracti0_.firstPublishedDate as firstPub5_0_, bestpracti0_.lastModifiedDate as lastModi6_0_, bestpracti0_.lastPublishedDate as lastPubl7_0_, bestpracti0_.summary as summary8_0_, bestpracti0_.title as title9_0_ from best_practices__kav bestpracti0_
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
000003990
13:11:51,504 DEBUG SQL:104 - select count(*) as y0_ from best_practices__kav this_
Hibernate: select count(*) as y0_ from best_practices__kav this_
13:11:51,504 INFO SimpleIndexingProgressMonitor:84 - HSEARCH000027: Going to reindex 23 entities
13:11:51,520 DEBUG SQL:104 - select this_.id as y0_ from best_practices__kav this_
Hibernate: select this_.id as y0_ from best_practices__kav this_
13:11:51,536 DEBUG SQL:104 - select this_.id as id1_0_0_, this_.articleNumber as articleN2_0_0_, this_.articleType as articleT3_0_0_, this_.best_Practices__c as best4_0_0_, this_.firstPublishedDate as firstPub5_0_0_, this_.lastModifiedDate as lastModi6_0_0_, this_.lastPublishedDate as lastPubl7_0_0_, this_.summary as summary8_0_0_, this_.title as title9_0_0_ from best_practices__kav this_ where this_.id in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: select this_.id as id1_0_0_, this_.articleNumber as articleN2_0_0_, this_.articleType as articleT3_0_0_, this_.best_Practices__c as best4_0_0_, this_.firstPublishedDate as firstPub5_0_0_, this_.lastModifiedDate as lastModi6_0_0_, this_.lastPublishedDate as lastPubl7_0_0_, this_.summary as summary8_0_0_, this_.title as title9_0_0_ from best_practices__kav this_ where this_.id in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
13:11:51,536 DEBUG SQL:104 - select this_.id as id1_0_0_, this_.articleNumber as articleN2_0_0_, this_.articleType as articleT3_0_0_, this_.best_Practices__c as best4_0_0_, this_.firstPublishedDate as firstPub5_0_0_, this_.lastModifiedDate as lastModi6_0_0_, this_.lastPublishedDate as lastPubl7_0_0_, this_.summary as summary8_0_0_, this_.title as title9_0_0_ from best_practices__kav this_ where this_.id in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: select this_.id as id1_0_0_, this_.articleNumber as articleN2_0_0_, this_.articleType as articleT3_0_0_, this_.best_Practices__c as best4_0_0_, this_.firstPublishedDate as firstPub5_0_0_, this_.lastModifiedDate as lastModi6_0_0_, this_.lastPublishedDate as lastPubl7_0_0_, this_.summary as summary8_0_0_, this_.title as title9_0_0_ from best_practices__kav this_ where this_.id in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
13:11:51,551 DEBUG SQL:104 - select this_.id as id1_0_0_, this_.articleNumber as articleN2_0_0_, this_.articleType as articleT3_0_0_, this_.best_Practices__c as best4_0_0_, this_.firstPublishedDate as firstPub5_0_0_, this_.lastModifiedDate as lastModi6_0_0_, this_.lastPublishedDate as lastPubl7_0_0_, this_.summary as summary8_0_0_, this_.title as title9_0_0_ from best_practices__kav this_ where this_.id in (?, ?, ?)
Hibernate: select this_.id as id1_0_0_, this_.articleNumber as articleN2_0_0_, this_.articleType as articleT3_0_0_, this_.best_Practices__c as best4_0_0_, this_.firstPublishedDate as firstPub5_0_0_, this_.lastModifiedDate as lastModi6_0_0_, this_.lastPublishedDate as lastPubl7_0_0_, this_.summary as summary8_0_0_, this_.title as title9_0_0_ from best_practices__kav this_ where this_.id in (?, ?, ?)
13:11:51,583 INFO SimpleIndexingProgressMonitor:88 - HSEARCH000028: Reindexed 23 entities


Enter search key (To exit type 'X')


Top
 Profile  
 
 Post subject: Re: Multiple rows returned, all duplicates of the first row
PostPosted: Sun Apr 07, 2013 9:24 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Interesting, I'm not spotting the error in your code right away so I'll need to debug it.
Moving the post to the correct forum BTW.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Multiple rows returned, all duplicates of the first row
PostPosted: Wed Apr 10, 2013 12:05 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
I've reproduced your test but I don't experience your problem:
https://github.com/Sanne/hibernate-search/commit/d334f62011c816de857c3b4edbf54f5b7408e8f4

Could you check?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Multiple rows returned, all duplicates of the first row
PostPosted: Wed Apr 10, 2013 10:14 pm 
Newbie

Joined: Fri Apr 05, 2013 3:28 pm
Posts: 9
On a lark, I changed the Id to String from char. Problem resolved.
:-)


Top
 Profile  
 
 Post subject: Re: Multiple rows returned, all duplicates of the first row
PostPosted: Thu Jul 04, 2013 5:51 am 
Newbie

Joined: Thu Jul 04, 2013 5:35 am
Posts: 1
Hi

Im also facign the same issue. Here is my entity


@Entity
@Table(name="HIST_TCS_CALC_DATA_1MIN", uniqueConstraints = {@UniqueConstraint(columnNames={"DATE_TIME","EQUIP_ID"})
})

public class HistDataOneMin implements Serializable{

@Id
@Column(name="EQUIP_ID")
private String EquipId;

@Id
@Column(name="DATE_TIME")
private Date Date_Time;

@Column(name="LANE_ID")
private Integer LaneId;

@Column(name="SPEED")
private Float Speed;

@Column(name="VOLUME")
private Integer Volume;

@Column(name="OCC")
private Integer Occ;

@Column(name="HEADWAY")
private Float HeadWay;

@Column(name="CB1")
private Integer Cb1;

@Column(name="CB2")
private Integer Cb2;

@Column(name="CB3")
private Integer Cb3;

@Column(name="CB4")
private Integer Cb4;

@Column(name="CB5")
private Integer Cb5;


@Column(name="P15_SP")
private Integer P15Sp;

@Column(name="P85_SP")
private Integer P85Sp;

@Column(name="GAP")
private Integer Gap;

@Column(name="CF_SP")
private Integer CfSp;

@Column(name="SB1")
private Integer Sb1;

@Column(name="SB2")
private Integer Sb2;

@Column(name="SB3")
private Integer Sb3;

@Column(name="SB4")
private Integer Sb4;
@Column(name="SB5")
private Integer Sb5;

@Column(name="SB6")
private Integer Sb6;

@Column(name="SB7")
private Integer Sb7;

@Column(name="SB8")
private Integer Sb8;

@Column(name="SB9")
private Integer Sb9;

@Column(name="SB10")
private Integer Sb10;

@Column(name="SB11")
private Integer Sb11;

@Column(name="SP1")
private Integer Sp1;

@Column(name="SP2")
private Integer Sp2;

@Column(name="SP3")
private Integer Sp3;

@Column(name="SP4")
private Integer Sp4;

@Column(name="SP5")
private Integer Sp5;

@Column(name="DIR")
private Integer Dir;

@Column(name="SEQ_NO")
private Integer SeqNo;


public String getEquipId() {
return EquipId;
}

public void setEquipId(String equipId) {
EquipId = equipId;
}

public Date getDate_Time() {
return Date_Time;
}

public void setDate_Time(Date date_Time) {
Date_Time = date_Time;
}

public Integer getLaneId() {
return LaneId;
}

public void setLaneId(Integer laneId) {
LaneId = laneId;
}

public Float getSpeed() {
return Speed;
}

public void setSpeed(Float speed) {
Speed = speed;
}

public Integer getVolume() {
return Volume;
}

public void setVolume(Integer volume) {
Volume = volume;
}

public Integer getOcc() {
return Occ;
}

public void setOcc(Integer occ) {
Occ = occ;
}

public Float getHeadWay() {
return HeadWay;
}

public void setHeadWay(Float headWay) {
HeadWay = headWay;
}

public Integer getCb1() {
return Cb1;
}

public void setCb1(Integer cb1) {
Cb1 = cb1;
}

public Integer getCb2() {
return Cb2;
}

public void setCb2(Integer cb2) {
Cb2 = cb2;
}

public Integer getCb3() {
return Cb3;
}

public void setCb3(Integer cb3) {
Cb3 = cb3;
}

public Integer getCb4() {
return Cb4;
}

public void setCb4(Integer cb4) {
Cb4 = cb4;
}

public Integer getCb5() {
return Cb5;
}

public void setCb5(Integer cb5) {
Cb5 = cb5;
}

public Integer getP15Sp() {
return P15Sp;
}

public void setP15Sp(Integer p15Sp) {
P15Sp = p15Sp;
}

public Integer getP85Sp() {
return P85Sp;
}

public void setP85Sp(Integer p85Sp) {
P85Sp = p85Sp;
}

public Integer getGap() {
return Gap;
}

public void setGap(Integer gap) {
Gap = gap;
}

public Integer getCfSp() {
return CfSp;
}

public void setCfSp(Integer cfSp) {
CfSp = cfSp;
}

public Integer getSb1() {
return Sb1;
}

public void setSb1(Integer sb1) {
Sb1 = sb1;
}

public Integer getSb2() {
return Sb2;
}

public void setSb2(Integer sb2) {
Sb2 = sb2;
}

public Integer getSb3() {
return Sb3;
}

public void setSb3(Integer sb3) {
Sb3 = sb3;
}

public Integer getSb4() {
return Sb4;
}

public void setSb4(Integer sb4) {
Sb4 = sb4;
}

public Integer getSb5() {
return Sb5;
}

public void setSb5(Integer sb5) {
Sb5 = sb5;
}

public Integer getSb6() {
return Sb6;
}

public void setSb6(Integer sb6) {
Sb6 = sb6;
}

public Integer getSb7() {
return Sb7;
}

public void setSb7(Integer sb7) {
Sb7 = sb7;
}

public Integer getSb8() {
return Sb8;
}

public void setSb8(Integer sb8) {
Sb8 = sb8;
}

public Integer getSb9() {
return Sb9;
}

public void setSb9(Integer sb9) {
Sb9 = sb9;
}

public Integer getSb10() {
return Sb10;
}

public void setSb10(Integer sb10) {
Sb10 = sb10;
}

public Integer getSb11() {
return Sb11;
}

public void setSb11(Integer sb11) {
Sb11 = sb11;
}

public Integer getSp1() {
return Sp1;
}

public void setSp1(Integer sp1) {
Sp1 = sp1;
}

public Integer getSp2() {
return Sp2;
}

public void setSp2(Integer sp2) {
Sp2 = sp2;
}
public Integer getSp3() {
return Sp3;
}
public void setSp3(Integer sp3) {
Sp3 = sp3;
}
public Integer getSp4() {
return Sp4;
}
public void setSp4(Integer sp4) {
Sp4 = sp4;
}
public Integer getSp5() {
return Sp5;
}
public void setSp5(Integer sp5) {
Sp5 = sp5;
}
public Integer getDir() {
return Dir;
}
public void setDir(Integer dir) {
Dir = dir;
}
public Integer getSeqNo() {
return SeqNo;
}
public void setSeqNo(Integer seqNo) {
SeqNo = seqNo;
}
public Date getInserTime() {
return InserTime;
}
public void setInserTime(Date inserTime) {
InserTime = inserTime;
}
}



Here is my DBService


session = sessionFactory.openSession();

String sql1="";

sql1="from HistDataOneMin hd where hd.InserTime >= to_date('"+getCommonUtil().getDateString(StartTime)+"','" +
"DD-MON-YYYY HH24:mI:ss') AND hd.InserTime< to_date('"+getCommonUtil().getDateString(EndTime)+"','DD-MON-YYYY HH24:mI:ss')";


HistOneMinDataList =session.createQuery(sql1).list();




This my output Im getting here

fetching the first id row and duplicating for all other same id row till the next id.

id/ Datetime/dir/speed
1000002101/2013-07-04 16:40:00/1/1/69.0
1000002101/2013-07-04 16:40:00/1/1/69.0
1000002101/2013-07-04 16:40:00/1/1/69.0
1000002101/2013-07-04 16:40:00/1/1/69.0
1000002101/2013-07-04 16:40:00/1/1/69.0
1000002101/2013-07-04 16:40:00/1/1/69.0
1000004101/2013-07-04 16:39:00/2/4/63.8
1000004101/2013-07-04 16:39:00/2/4/63.8
1000004101/2013-07-04 16:39:00/2/4/63.8
1000004101/2013-07-04 16:39:00/2/4/63.8
1000005101/2013-07-04 16:39:00/1/1/49.1
1000005101/2013-07-04 16:39:00/1/1/49.1
1000005101/2013-07-04 16:39:00/1/1/49.1
1000001001/2013-07-04 16:41:00/2/1/52.7
1000001001/2013-07-04 16:41:00/2/1/52.7
1000001001/2013-07-04 16:41:00/2/1/52.7
1000001001/2013-07-04 16:41:00/2/1/52.7
1000001001/2013-07-04 16:41:00/2/1/52.7
1000001001/2013-07-04 16:41:00/2/1/52.7
1000000101/2013-07-04 16:40:00/1/3/68.4
1000000101/2013-07-04 16:40:00/1/3/68.4
1000000101/2013-07-04 16:40:00/1/3/68.4
1000000101/2013-07-04 16:40:00/1/3/68.4
1000000101/2013-07-04 16:40:00/1/3/68.4
1000000101/2013-07-04 16:40:00/1/3/68.4
1000003901/2013-07-04 16:40:00/2/1/72.0
1000003901/2013-07-04 16:40:00/2/1/72.0
1000003901/2013-07-04 16:40:00/2/1/72.0
1000003901/2013-07-04 16:40:00/2/1/72.0
1000003901/2013-07-04 16:40:00/2/1/72.0
1000003901/2013-07-04 16:40:00/2/1/72.0
1000005702/2013-07-04 16:40:00/2/3/30.7
1000005702/2013-07-04 16:40:00/2/3/30.7


but in database all rows are having different values.

My table doesnot have primary key. is it problem or something else i missed out in my code...Anyone could help me to find out the problem?

Thanks
Regs
Visa



a


Top
 Profile  
 
 Post subject: Re: Multiple rows returned, all duplicates of the first row
PostPosted: Thu Jul 04, 2013 8:37 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Visa,
sorry but I don't see how your problem is related to this thread, it is not even using Hibernate Search.
Could you please use the correct forum and start a new question:
https://forum.hibernate.org/viewforum.php?f=1

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.