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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 1106

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: 7029
    
  16

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?
Artlicles 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retrive array from database
 
Similar Threads
Can you have a String type method return two String values, or do I need to use String array?
DataTap Connection pool usage?
Eclipselink problem with MySQL Stored Procedures
doubt having servlet connect to oracle XE database
What is the problem with this code!!!