• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use println for reusltlist in hibernate?

 
Mandar Khire
Ranch Hand
Posts: 569
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...





 
Mandar Khire
Ranch Hand
Posts: 569
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should i follow this website's example at the beginning?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using the old style Vector class? I think you want to use ArrayList instead.

Mark
 
Mandar Khire
Ranch Hand
Posts: 569
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 569
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic