aspose file tools*
The moose likes Object Relational Mapping and the fly likes how to use println for reusltlist in hibernate? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "how to use println for reusltlist in hibernate?" Watch "how to use println for reusltlist in hibernate?" New topic
Author

how to use println for reusltlist in hibernate?

Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 504

I have one program which has 2 textfields & 1jbutton
1 table in mysql which contain some values like Actorid,first name,last name,date,i manually enter values in table...
when i run program, in textfield i write specific name then click button, i got result in table.
Now i try to see specific value of that fetched resultlist then how should i do?
eg.


now i try to see by println statement
like
Last name = khire

here i post some code which i think it should contain something should change...







Millions saw the apple fall, but Newton asked why.
Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 504

Should i follow this website's example at the beginning?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

What version of Hibernate are you using. Hibernate is currently on 4.x, and back a number of years ago they released 3.1, in which you no longer should write code like



With Hibernate 3.1 or higher your code should look like



Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Why are you using the old style Vector class? I think you want to use ArrayList instead.

Mark
Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 504


First i try to learn with List then i go forward with ArrayList.
Vector i removed..
I done changes as follows then i can enter values from application to db by hibernate...but cant read it again...
Actually i am trying program in Swing with mysql..program for Drag & drop facility to Array of JPanels within jpanel...
I store old & new location x,y axis in db...
In past i done swing with jdbc...same trying with hibernate instead of jdbc
Complete program i will not post...(people not read code more than few lines...)...but i post code which few lines more than 30...
I am trying as follows:-
at start of program READ, then do some work UPDATE,(after UPDATE immediately need to be READ)...
So i try this


Now i confuse...
In this currently i am trying that db values should print in console when program start...if this possible then i will reuse them as i want.
Any help?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

"Swing with mysql..program for Drag & drop facility to Array of JPanels within jpanel… "

We know that already and it is beside the point. Your question doesn't change because of your application. It is irrelevant. You don't have to add that to an ORM question. Do you understand that each part of your application is completely separate and one doesn't change how the other works. If I had a web application with saving People's name, the Hibernate code would be the same no matter what.

You didn't answer my question of what version of Hibernate you are using. Because if you have Hibernate 3.1 or higher, then you are doing the Hibernate code wrong.

Mark
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

So you just overwrote your query you want to run

myhql="Select * from location_parameter_table";
Query q = session1.createQuery(myhql);

So no matter what method calls this method it will always run the exact same query over and over again.

Mark
Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 504

You didn't answer my question of what version of Hibernate you are using. Because if you have Hibernate 3.1 or higher, then you are doing the Hibernate code wrong.

I download latest hibernate version from Hibernate/download Released bundle & same time i use hibernate plugin in eclipse..
I add jar file in project named Hibernate3.jar also i added jars which from that released bundle extract...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to use println for reusltlist in hibernate?