-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Need Help : How to save multiple values with hibernate ?
PostPosted: Thu Feb 12, 2009 3:46 am 
Beginner
Beginner

Joined: Thu Dec 11, 2008 2:30 am
Posts: 47
I have form for enter data. like this

(* _____ are text fields)


sale_number ______
sale_year ______

main sale
-----------

1 ________ (some name)
2 ________
3 ________
4 ________
5 ________

I want to save(according to this form) 5 records to the database under one 'sale_number' and 'sale_year'.

I set above values to the attributes of the entity class.

My database has fields like this -:
"sale_number, sale_year, main_sale, other_sale".

I want my database to be inserted 5 records with same 'sale_number' and 'sale_year'.


Last edited by dilanalex on Thu Feb 12, 2009 7:05 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 5:53 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
I dont get what your question is.

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 7:03 am 
Beginner
Beginner

Joined: Thu Dec 11, 2008 2:30 am
Posts: 47
When the form is submitted values are set to the entity class's attribute.
This is my entity class.

Code:

public class OrderOfSale implements Serializable {

     private String[] brokerName;

}



I want to set above 5 text fields values to this 'brokerName' array.
I renamed all text fields name property to be as same name(like brokerName). but all elements of array shows same value which I entered as first text field value.

I want to fill this array form the values of above 5 text field. But seems to be difficult....

please help....

regards,
Dilan.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 7:07 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
Can you post your mapping for this entity

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 7:20 am 
Beginner
Beginner

Joined: Thu Dec 11, 2008 2:30 am
Posts: 47
this is my entity class...

Code:

@Entity
@Table(name="TRN_ODEROFSALE")
public class OrderOfSale implements Serializable {

private String[] brokerName;

@Column(name="BROKER_NAME")
    public String[] getBrokerName() {
        return brokerName;
    }

    public void setBrokerName(String brokerName[]) {
        this.brokerName = brokerName;
    }

}



This is the necessary part of the form......

Code:

<input name="brokerName" id="exEstate_01" type="text" size="50" />
<input name="brokerName" id="exEstate_02" type="text" size="50" />
<input name="brokerName" id="exEstate_03" type="text" size="50" />
<input name="brokerName" id="exEstate_04" type="text" size="50" />
<input name="brokerName" id="exEstate_05" type="text" size="50" />



Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 7:28 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
I get a feeling that you are using some technologies which I am not aware of.

May be you should post your environment like what technology you use for the front end, the back end etc. and anybody having expertise in that will help you.

_________________
Regards,
Litty Preeth


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.