[jboss-user] [JBossWS] - Re: Using entities with collections?

fheldt do-not-reply at jboss.com
Mon Jul 31 02:56:35 EDT 2006


Here's what i did: The entity bean is field mapped and the getters/setters convert between Collection and Array.

A sample:


  | public class MyEntityBean implements java.io.Serializable {
  | 	@Id
  | 	@Column(name="id")
  | 	private int id;
  |         ...
  | 	@OneToMany(mappedBy = "abc")
  | 	private Set<ColumnHeader> colHeaders;
  |         ...
  | 	public ColumnHeader[] getColumns() {
  | 	    return this.colHeaders.toArray(new ColumnHeader[ this.colHeaders.size() ]);
  | 	}
  | 	public void setColumns(ColumnHeader[] colHeaders) {
  | 	    this.colHeaders.clear();
  | 	    for (int i = 0; i < colHeaders.length; i++) {
  | 	        this.colHeaders.add(colHeaders[ i ]);
  | 	    }
  | 	}
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961781#3961781

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961781



More information about the jboss-user mailing list