aspose file tools*
The moose likes Object Relational Mapping and the fly likes How to retrive array from database 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 retrive array from database" Watch "How to retrive array from database" New topic
Author

How to retrive array from database

pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
I have stored an array in database field name "exp_values" like :

[{"concentration":"30","answers":60},{"concentration":"30","answers":60},{"concentration":"30","answers":60}]

and I want to retrieve from database I am using jsp servlet and I created pojo(bean) class like




and also I used hibernate for retrieving values from database I want these array as it is
in java how can I do?
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

ok can we break this question down...

do you know how to do the hibernate end, how to get the data from the database using hibernate, and get the data back from there into POJOs?


This will be a lot quicker if you tell us what your exact problem is, it is going to take a very long time if you wait for me to ask a whole list of yes or no questions, and to be honest I may get bored halfway.
pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
I know the hibernate my problem is that how can I retrieve that array and stored in JSONObject
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7807
    
  21

pravin rasal wrote:I have stored an array in database field name "exp_values" like :
[{"concentration":"30","answers":60},{"concentration":"30","answers":60},{"concentration":"30","answers":60}]

Sounds like that may be your problem right there. Seems very contrived to me (and totally de-normalized). Why not just set up a database table for it?

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
My thread is solved .I done this by using text datatype in mysql....thanks to all
 
jQuery in Action, 2nd edition
 
subject: How to retrive array from database