Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Hibernate Annotation

Posted on 2009-12-22
14
Medium Priority
?
533 Views
Last Modified: 2013-12-18
How to call max function in hibernatedaosupport using getHibernateTemplate().find

for exp :- getHibernateTemplate().find("from JobworkflowdtlORM  where  V_CVDPL_NO='EM090800013' and maxelement(JobworkflowdtlORM.linenumber) ");

0
Comment
Question by:ajaygund
  • 9
  • 2
11 Comments
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26103298
getHibernateTemplate().find("select  max(inlineNo) from  JobworkflowdtlORM  where  V_CVDPL_NO=' "+EM090800013 " ' ");
0
 

Author Comment

by:ajaygund
ID: 26110569
I have Use this code :- getHibernateTemplate().find("select  max(inlineNo) from  JobworkflowdtlORM  where  V_CVDPL_NO=' "+EM090800013 " ' ");


But show Error :-
java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.AggregateNode
 \-[AGGREGATE] AggregateNode: 'max'
    \-[IDENT] IdentNode: 'inlineNo' {originalText=inlineNo}

Please give me solution .

Thanks in advance.
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26110597
Can u tell me what is this one ??

1.V_CVDPL_NO ?? is it the property in Bean calss ??

2. is it string value ??

3. is there any filed name called V_CVDPL_NO in ur JobworkflowdtlORM
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26110601
which one filed  u want to get the max value ??

I gave the example only !!

can u post the POJO of JobworkflowdtlORM
0
 

Author Comment

by:ajaygund
ID: 26111245
/**
 *
 */
package com.dummy.orm;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.GenericGenerator;

/**
 * @author rajesh.bihade
 * date 10 Sept 2009
 */
      
      @Entity
      @Table (name="JOB_WORK_FLOW_DTL")      
      @org.hibernate.annotations.Entity (dynamicUpdate = true, dynamicInsert = true)
public class JobworkflowdtlORM implements Serializable{

      
      @ Id
      @ GeneratedValue (generator = "gen")
      @ GenericGenerator (name = "gen", strategy = "increment")
      @ Column(name="V_CVDPL_NO")
      private String order_no2 = null;
      


    @ OneToMany (cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "jobworkflowdtlORM")
      @ BatchSize (size = 5)
    private Set <CoreteamORM> coreteamORM = new HashSet <CoreteamORM> ();          
      //private CoreteamORM coreteamORM;
   
    @ Column (name = "N_LINENUMB",  length = 50, insertable = true, updatable = true, nullable = false)
   
      private String  linenumber  =null      ;
 

      /**
       * @return the order_no
       */
      public String getOrder_no2() {
            return order_no2;
      }

      /**
       * @param order_no the order_no to set
       */
      public void setOrder_no2(String order_no2) {
            this.order_no2 = order_no2;
      }

      
      

      /**
       * @return the coreteamORM
       */
      public Set<CoreteamORM> getCoreteamORM() {
            return coreteamORM;
      }

      /**
       * @param coreteamORM the coreteamORM to set
       */
      public void setCoreteamORM(Set<CoreteamORM> coreteamORM) {
            this.coreteamORM = coreteamORM;
      }

      /**
       * @return the linenumber
       */
      public String getLinenumber() {
            return linenumber;
      }

      /**
       * @param linenumber the linenumber to set
       */
      public void setLinenumber(String linenumber) {
            this.linenumber = linenumber;
      }

      

      
      /**
       * @return the coreteamORM
       */
      /**public CoreteamORM getCoreteamORM() {
            return coreteamORM;
      }

      /**
       * @param coreteamORM the coreteamORM to set
       */
      /*
      public void setCoreteamORM(CoreteamORM coreteamORM) {
            this.coreteamORM = coreteamORM;
      }

 */
      
      
}
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26273660
what is V_CVDPL_NO ??

i cant find V_CVDPL_NO  in bean ur class??
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26339836
i gave correct solution
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26341855
0
 
LVL 20

Accepted Solution

by:
Sathish David  Kumar N earned 1000 total points
ID: 26386813
His question is
<<<<<How to call max function in hibernatedaosupport using getHibernateTemplate().find

i gave answer for that eg was
getHibernateTemplate().find("select  max(inlineNo) from  JobworkflowdtlORM  where  V_CVDPL_NO=' "+EM090800013 " ' ");

He gave the query as example only thats clear in his question .I gave sloution how we use max funtion in getHibernateTemplate for his example .

But he use the same(example) as his query and come for another question !!
that have an error !!
thats is his next question

i gave soluion for that !!

V_CVDPL_NO this filed not present in his POJO class so i mention that in my last post of my answer .

0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26386814
so that only error was coming !!
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26427364
i didnt get any updated msg !
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question