type casting

type casting

<--bean class-->method calllist is of object type

List <Object> o=bss.totalList(i);

<--service class--> public List (object type) <Object> totalList(int pi){

     try{

Query q= em.createQuery("select p,c,b from Book b ,Customer c , Purchage p where c.uid=p.customer.uid and p.book.bid=b.bid and p.pid=:pid") .setParameter("pid", pi);

     return  q.getResultList();
     }catch(Exception e){
         return null;
     }

how to type cast object type to entity type .

View Answers

March 29, 2011 at 1:53 PM

public List dataList(){
ArrayList list=new ArrayList();
try{
     Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from employee");
           while(rs.next()){
               list.add(rs.getString("name"));
               list.add(rs.getString("address"));
               list.add(rs.getString("contactNo"));
               list.add(rs.getString("email"));

}
}
catch(Exception e){}
return list;
}









Related Tutorials/Questions & Answers:
type casting
type casting  what is type casting
Type casting
Type casting  how to type cast a string value to byte array
Advertisements
type casting
type casting  <--bean class-->method calllist is of object type... List (object type) <Object> totalList(int pi){ (adsbygoogle = window.adsbygoogle || []).push({}); try{ Query q= em.createQuery
type casting
type casting  int n=20; n=sizeof((char)(float)n); what is n value
type casting purpose
type casting purpose  what is type casting , could u explain with practical example
type casting - Java Beginners
type casting and conversion  I am beginner and my query is Importance of type casting and conversion  Hi friend,public class TypeCasting{ public static void main(String[] args){ boolean t = true; byte b = 2; short s
ModuleNotFoundError: No module named 'type-casting'
ModuleNotFoundError: No module named 'type-casting'  Hi, My Python... 'type-casting' How to remove the ModuleNotFoundError: No module named 'type-casting' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'type-casting'
ModuleNotFoundError: No module named 'type-casting'  Hi, My Python... 'type-casting' How to remove the ModuleNotFoundError: No module named 'type-casting' error? Thanks   Hi, In your python
Java Type Casting - Java Beginners
Java Type Casting  what is object type casting? give some example with related
Java type casting
Java type casting  What is Downcasting
Java type casting
Java type casting  Can a Byte object be cast to a double value
java type casting problem - Java Beginners
java type casting problem  what is type casting? what is the type of type casting? explain with example?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/TypeCasting.shtml
Type casting in java
Type casting in java In this section you will learn about type casting in java. Type casting is to convert one type to another type. Java support two types of casting; primitive type and reference type casting. Reference type casting
Type casting the returned value of a method.
Type casting the returned value of a method.  Hi, How do you type cast the returned value of a method so that you can avoid creating a temporary...) will be of type OnOffButton. I want to avoid: OnOffButton btn = (OnOffButton
Casting (Type Conversion)
Casting (Type Conversion)      ... casting. In java one object reference can be type cast into another object reference. This casting may be of its own type or to one of its subclass or superclasss
What is casting?
What is casting?   Hi, What is casting? thanks
Casting in java - Java Beginners
Casting in java   Hi, I want to know Casting in detail... is implicit casting and Explicit casting . Implicit casting : Ex - assign... Explicit casting : Ex - Assign superclass variable to subclass
PHP Type Juggling
Type Juggling In PHP: Unlike other programming languages like C,C++ and Java... a float value to a variable then it becomes float type and if we assign... type, but if we add one integer and one float type variable then the result
type mismatch
type mismatch  Statement s= con.createStatement(); this line gives error of "type mismatch" I am using eclips nd new to servlet nd JDBC, Please help me, Thank you
data type
data type  which data type is used to store video file in mysql databse
fastest type of JDBC driver
fastest type of JDBC driver  What is the fastest type of JDBC driver
Document Type Definition
Document Type Definition  What is Document Type Definition
coding for re-type password
coding for re-type password  coding for re-type password
What is mime type in HTML
What is mime type in HTML  what is mime type in html? is it different in new HTML5
What is mime type in HTML
What is mime type in HTML  what is mime type in html? is it different in new HTML5
eraser type generics in java
eraser type generics in java  Explain eraser type generics in java with example
ModuleNotFoundError: No module named 'type'
ModuleNotFoundError: No module named 'type'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'type' How to remove the ModuleNotFoundError: No module named 'type' error
ModuleNotFoundError: No module named 'type'
ModuleNotFoundError: No module named 'type'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'type' How to remove the ModuleNotFoundError: No module named 'type' error
ModuleNotFoundError: No module named 'type'
ModuleNotFoundError: No module named 'type'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'type' How to remove the ModuleNotFoundError: No module named 'type' error
ModuleNotFoundError: No module named 'type'
ModuleNotFoundError: No module named 'type'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'type' How to remove the ModuleNotFoundError: No module named 'type' error
Fastest type of JDBC Driver
Fastest type of JDBC Driver  hello, What is the fastest type of JDBC driver?   hii,ADS_TO_REPLACE_1 Type 4 is the fastest JDBC driver
Unable to cast object of type 'Microsoft.Xrm.Sdk.OptionSetValue' to type 'System.String'
Unable to cast object of type 'Microsoft.Xrm.Sdk.OptionSetValue' to type 'System.String'  Hi, I am working on Dynamics 365 plugin and while taking... object of type 'Microsoft.Xrm.Sdk.OptionSetValue' to type 'System.String
Reference type Vs Object type. - Java Beginners
Reference type Vs Object type.  Can anyone explain the exact... or object type variable which may reference a Book object or an object of any... of Employee Class 'Employee' would be the REFERENCE TYPE and Class
type 4 jdbc driver
type 4 jdbc driver   i read in this site that type 4 jdbc driver is the fastest one so used it to connect with the database.......but not tried another drivers,....can u specifically answer me why type 4 is the fastest one
elasticsearch search by type
elasticsearch search by type  Hi, How to perform search by type... { "query": { "type" : { "value" : "doc" } } } Above query will search all the data with the type "doc". Thanks
SERIAL data type
SERIAL data type   hello, What is SERIAL data type in MySQL?   hii,ADS_TO_REPLACE_1 SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
incomplete pointer type NSMutableDictionary
incomplete pointer type NSMutableDictionary  My iphone app is throwing the "incomplete pointer type NSMutableDictionary" issue on running the iphone app. What is this issue and how can i remove it. NSMutableDictionary *dict
methods type - Java Beginners
methods type in Java  Give me an example programs of methods types in Java
alter data type
alter data type  alter data type of subName column for subject table to varchar(40
incompatble type error
incompatble type error  class ArithmeticExceptiontest { public static void main(String args[]) { int num1 = 0; int num2=10...); } } } trows incampatble type error
type 4 drivers - JDBC
type 4 drivers  Hi! What is the syntax for Type - 4 drivers. give me any sample code. Thanks in advance..  Hi Friend, Please visit the following link: http://www.roseindia.net/jdbc/jdbc-driver-and-its
HSSFCell to String type conversion
HSSFCell to String type conversion  Hello, Can anyone help me convert HSSFCell type to string. There is a solution in the following URL, but the method getWorkbook() is not defined for the class HSSFCell. Thanks in advance
the array list contains similar type of elements or disimilar type of elements
the array list contains similar type of elements or disimilar type of elements  the array list contains similar type of elements or disimilar type of elements
UIButton sender type cast
UIButton sender type cast  Hi, I want to type cast sender object into UIButton. Please provide me code. ThanksADS_TO_REPLACE_1   HI, Its very easy to typecast the sender object into UIButton. Please see the following
Type of JSP Directive Tag
Type of JSP Directive Tag  How many types of directive tag in the JSP?   Hi, The answer is given below:ADS_TO_REPLACE_1 There are three types of directive tag. 1. page 2. Include 3. Tag Lib Thanks
The type ServiceRegistryBuilder is deprecated
The type ServiceRegistryBuilder is deprecated  I am trying to Create the SessionFactory in Hibernate using following code: Configuration...(serviceRegistry); It's giving the following error: The type ServiceRegistryBuilder
Enum data type
Enum data type  How can we use enum data type in java program?  ... data type. Here we have defined Fruits as enum type by using the enum keyword. Now... data type. Here we have defined Fruits as enum type by using the enum keyword. Now
different type input in java
different type input in java  hiiiii... get input different different type like as DataInputStream,Scanner i want to get source code of these all type of input method. thank   Java Read through DataInputStream: import
illegal start type, HELP!
illegal start type, HELP!  import java.util.Scanner; public class... keyboard = new Scanner(System.in); System.out.print("Please type the total number... type the total value of the purchase: "); double total = keyboard.nextDouble
Type Conversion - Java Beginners
Type Conversion   Hai, rajanikanth, Please explain how to convert from integer value to a string value .In a database operation i want to convert it.   hi jagadish Suppose int num = 10; String id = ""+num

Ads