List of usage examples for org.apache.ibatis.session SqlSession insert
int insert(String statement, Object parameter);
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisOutgoingCallerIdsDao.java
License:Open Source License
@Override public void addOutgoingCallerId(final OutgoingCallerId outgoingCallerId) { final SqlSession session = sessions.openSession(); try {/*from w w w.j a va 2 s . com*/ session.insert(namespace + "addOutgoingCallerId", toMap(outgoingCallerId)); session.commit(); } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisRecordingsDao.java
License:Open Source License
@Override public void addRecording(Recording recording) { if (s3AccessTool != null) { URI s3Uri = s3AccessTool.uploadFile(recordingPath + "/" + recording.getSid().toString() + ".wav"); if (s3Uri != null) { recording = recording.updateFileUri(s3Uri); }//from w w w . j a v a2 s . c o m } else { recording = recording.updateFileUri(generateLocalFileUri("/restcomm/recordings/" + recording.getSid())); } final SqlSession session = sessions.openSession(); try { session.insert(namespace + "addRecording", toMap(recording)); session.commit(); } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisRegistrationsDao.java
License:Open Source License
@Override public void addRegistration(final Registration registration) { final SqlSession session = sessions.openSession(); try {/*w w w .j a v a2s. co m*/ session.insert(namespace + "addRegistration", toMap(registration)); session.commit(); } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisShortCodesDao.java
License:Open Source License
@Override public void addShortCode(final ShortCode shortCode) { final SqlSession session = sessions.openSession(); try {//from w w w. j a va2 s .co m session.insert(namespace + "addShortCode", toMap(shortCode)); session.commit(); } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisSmsMessagesDao.java
License:Open Source License
@Override public void addSmsMessage(final SmsMessage smsMessage) { final SqlSession session = sessions.openSession(); try {/*from w ww . j a v a2 s . co m*/ session.insert(namespace + "addSmsMessage", toMap(smsMessage)); session.commit(); } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisTranscriptionsDao.java
License:Open Source License
@Override public void addTranscription(final Transcription transcription) { final SqlSession session = sessions.openSession(); try {/*from w w w.j av a 2 s . c om*/ session.insert(namespace + "addTranscription", toMap(transcription)); session.commit(); } finally { session.close(); } }
From source file:org.mobicents.servlet.sip.restcomm.dao.mybatis.MybatisRecordingsDao.java
License:Open Source License
@Override public void addRecording(final Recording recording) { final SqlSession session = sessions.openSession(); try {/*from w w w . j ava 2s .com*/ session.insert(namespace + "addRecording", toMap(recording)); session.commit(); } finally { session.close(); } }
From source file:org.mobicents.servlet.sip.restcomm.dao.mybatis.MybatisSandBoxesDao.java
License:Open Source License
@Override public void addSandBox(final SandBox sandBox) { final SqlSession session = sessions.openSession(); try {//from ww w .jav a 2s . com session.insert(namespace + "addSandBox", toMap(sandBox)); session.commit(); } finally { session.close(); } }
From source file:org.mule.module.mybatis.MyBatisConnector.java
License:CPAL v1.0
/** * Execute Mybatis insert function/* w w w . ja v a 2s . c o m*/ * * {@sample.xml ../../../doc/mule-mybatis-module.xml.sample mybatis:insert} * * @param statement Fully qualified SQL statement ex: org.mybatis.example.BlogMapper.selectBlog * @param payload The parameter to the SQL statement * @return Result of MyBatis call * @throws IOException Io Error */ @Processor public Object insert(String statement, @Payload Object payload) throws IOException { SqlSession sqlSession = createSqlSession(); Object result = sqlSession.insert(statement, payload); closeSqlSession(sqlSession); return result; }
From source file:org.mybatis.scripting.velocity.use.VelocityLanguageTest.java
License:Apache License
@Test public void testSelectKey() { SqlSession sqlSession = sqlSessionFactory.openSession(); try {/*from w w w . jav a 2s . com*/ Name fred = new Name(); fred.setFirstName("Fred"); fred.setLastName("Flinstone"); sqlSession.insert("org.mybatis.scripting.velocity.use.insertName", fred); assertTrue(fred.getId() != 0); } finally { sqlSession.close(); } }