This content has been marked as final.
Show 2 replies
-
1. Re: Logging user activity
ananymous7239 Feb 21, 2011 12:29 AM (in response to swd847)Click HELP for text formatting instructions. Then edit this text and check the preview.
Hi Stuart i want to save 5 uploaded images as 5 records in Database .you have any idea about this please help me .i am able to save only the last upload image. this is my persist method @Override @Begin(join = true) @End public String persist() { try { BeanUtils.copyProperties(getInstance(), doImageUpload); for (int num = 0; num < files.size(); num++) { getInstance().setData(files.get(num).getData()); getInstance().setLength(files.get(num).getData().length); log.info("...............files in persist"+files.get(num).getLength()); log.info("...............files in persist"+files.size()); log.info("...............files in persist"+files.get(num).getData()); } super.persist(); } catch (Exception e) { log.info("exception" + e); } return "done"; }
-
2. Re: Logging user activity
kragoth Feb 21, 2011 11:13 PM (in response to swd847)
venu gopal wrote on Feb 21, 2011 00:29:
Click HELP for text formatting instructions. Then edit this text and check the preview.Hi Stuart i want to save 5 uploaded images as 5 records in Database .you have any idea about this please help me .i am able to save only the last upload image. this is my persist method @Override @Begin(join = true) @End public String persist() { try { BeanUtils.copyProperties(getInstance(), doImageUpload); for (int num = 0; num < files.size(); num++) { getInstance().setData(files.get(num).getData()); getInstance().setLength(files.get(num).getData().length); log.info("...............files in persist"+files.get(num).getLength()); log.info("...............files in persist"+files.size()); log.info("...............files in persist"+files.get(num).getData()); } super.persist(); } catch (Exception e) { log.info("exception" + e); } return "done"; }
Your question does not relate to what Stuart is talking about. Create a new topic for people to respond to. But, your problem is simple, if you want to save 5 files to a database then stop trying to put them all into the same object instance. Every time you call getInstance().setData(xxxxx) you are overwriting what was there. This is simple java object stuff nothing to do with database or seam or hibernate or any framework at all.