[jboss-user] [JBoss Seam] - Re: <s:fileUpload> problem

jquery@interia.pl do-not-reply at jboss.com
Wed Apr 18 17:27:33 EDT 2007


Hi,

thanks for the recommendation but suppose that we have the following classes:


  | 
  | public class Document implements Serializable{
  | 	
  | 	InputStream file;
  | 
  | 	public InputStream getFile() {
  | 		return file;
  | 	}
  | 
  | 	public void setFile(InputStream file) {
  | 		this.file = file;
  | 	}
  | }
  | 
  | @Name("documentHome")
  | public class DocumentHome extends EntityHome<Document>{
  | 	
  | 	@Override
  | 	protected Document createInstance(){
  | 		Document document = new Document();
  | 		return document;
  | 	}
  | 
  | }
  | 
  | @Entity
  | @Table(name = "PROFILE_APPENDIX", schema = "DB2USER")
  | public class ProfileAppendix implements java.io.Serializable {
  | 
  | 	private long id;
  | 	private Profile profile;
  | 	private String name;
  | 	private String description;
  | 	private Blob appendix;
  | (...)
  | }
  | 
  | @Name("profileAppendixHome")
  | public class ProfileAppendixHome1 extends EntityHome<ProfileAppendix1> {
  | 
  | 	@In(create = true)
  | 	ProfileHome profileHome;
  | 	
  | 	@In(create=true)
  | 	EntityManager entityManager;
  | 	
  | 	@In(create=true)
  | 	DocumentHome documentHome;
  | 
  | 	public void saveProfileAppendix(){}
  | 
  | }
  | 

When the form is submitted "file" variable from Document class is populated but I don't know how 
to populate Blob appendix variable in saveProfileAppendix() function using 
documentHome.instance.getFile(). How to cast InputStream to Blob?
Any help appreciated.


Best regards,
jquery

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

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



More information about the jboss-user mailing list