Inserisci qui il codice... (lug 31, 2015 10:39:02 AM com.sun.faces.lifecycle.ApplyRequestValuesPhase execute.... <resultMap id="fileEntityResultMap" type="FileDB"> <id column="id_file" jdbcType="BIGINT" property="idFile" /> <result column="id_property" jdbcType="BIGINT" property="idProperty" /> <result column="dt_property" jdbcType="DATE" property="dtProperty" /> <result column="id_property2" jdbcType="BIGINT" property="idProperty2" /> <result column="ds_property2" jdbcType="VARCHAR" property="dsProterty2" /> <result column="bt_fileBytes" jdbcType="BLOB" property="btFileBytes" /> <result column="fl_delete" jdbcType="BOOLEAN" property="flDelete" /> </resultMap> <insert id="insertFile" parameterType="FileDB"> <selectKey keyProperty="idFile" resultType="java.lang.Long" order="BEFORE"> SELECT nextval('an_file_sequence'); </selectKey> INSERT INTO an_file (id_file id_property, dt_property, id_property2, ds_property, bt_fileBytes, fl_delete) VALUES ( #{idFile,jdbcType=INTEGER}, #{idProperty,jdbcType=INTEGER}, #{dtProperty,jdbcType=TIMESTAMP}, #{idProperty2,jdbcType=INTEGER}, #{dsProterty2,jdbcType=VARCHAR}, #{btFileBytes,jdbcType=BLOB}, #{flDelete,jdbcType=BOOLEAN} ) </insert> </mapper>public void copyFile(String fileName, InputStream in) { logger.debug("copy file"); try { OutputStream out = new FileOutputStream(new File(destination + fileName)); int read = 0; buffer = new byte[10485760];// 10 Mb in byte while ((read = in.read(buffer)) != -1) { out.write(buffer, 0, read); } in.close(); out.flush(); out.close(); } catch (IOException e) { JsfUtility.addErrorMessage("error.CaricamentoFile", "error.CaricamentoFile"); } creaFileDB(buffer); }
private void creaFileDB (byte[] fileB) { Utente utente = this.getUtenteLoggato(); this.fileDaInserire.setDsNomeFile(this.event.getFile().getFileName()); this.fileDaInserire.setIdUtenteCreate(utente.getIdUtente()); this.fileDaInserire.setIdEvento(1L); this.fileDaInserire.setDtDatacreazione(new Date()); this.fileDaInserire.setBtFileBytes(fileB); this.fileDaInserire.setFlDelete(false); fileMapper.insertFile(fileDaInserire); }--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Table: an_file
-- DROP TABLE an_file;
CREATE TABLE an_file( id_file bigint, id_user_create bigint,
dt_date_crate timestamp without time zone, ds_name character varying(255), ds_tipo_file character varying(7),
bn_file bytea, fl_delete character(1))WITH ( OIDS=FALSE);ALTER TABLE an_file OWNER TO postgres;