Checkbox Example
Just call at the end of ajax
componentHandler.upgradeAllRegistered();
Checkbox Example
Just call at the end of ajax
componentHandler.upgradeAllRegistered();
A.CHANNEL_ID IN (select regexp_substr(P_CHANNEL_ID,'[^,]+', 1, level) from dual connect by level <= regexp_count (P_CHANNEL_ID, '[,]') +1)
Component in HTML
<span>{{country.label}}</span>
Code in JS(Controller)
var self = this; self.selectedCountry = {};//Already selected option and also it contains the whole object selected from autocomplete //Below shows how to show default selected value self.selectedCountry = self.countryList.find(item => item.id === self.userObj.countryId); //createFilterFor is triggered when we start typing self.createFilterFor = function(query,list) { var results = query ? list.filter(createFilterFor(query)) : list; return results; }; function createFilterFor(query) { var lowercaseQuery = angular.lowercase(query); return function filterFn(state) { return (state.label.indexOf(lowercaseQuery) === 0); }; } //On selection of option we can bind it to appropriate model dynamically as well as we can trigger what is needed(In my case calling stateList) self.onItemSelection = function(valueObj,objId){ if(valueObj!=undefined){ eval("self."+objId + " = '" + valueObj.id+"'"); if(objId=='userObj.countryId'){ loadState(valueObj.id);//calling stateList based on countryId } }else{ eval("self."+objId + " = ''"); } };
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.javahunter.taher.utility; import freemarker.template.Configuration; import freemarker.template.DefaultObjectWrapper; import freemarker.template.Template; import java.io.File; import java.io.FileOutputStream; import java.io.StringWriter; import java.util.HashMap; import java.util.Map; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.StringUtils; /** * * @author TaherT */ public class DTOGenerator { public static void main(String[] args) throws Exception { String[] springConfig = {"/database.xml"}; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JdbcTemplate jdbcTemplate = context.getBean(JdbcTemplate.class); String[] tables = new String[]{"student"};//Add Comma seperated Tables to generate code. genDTO(tables,jdbcTemplate);//Generate Data Transfer Object from mysql Table genXML(tables, jdbcTemplate);//Generate XML required for spring batch configs } /** * @param args the command line arguments */ public static void genDTO(String[] tables, JdbcTemplate jdbcTemplate) throws Exception { for (int i = 0; i < tables.length; i++) { String tableName = tables[i]; String className = tables[i]; String modelData = generateDTOCode(tableName, className, jdbcTemplate); File file = new File(DTOGenerator.class.getResource("").getFile().replace("target/classes", "src/main/java").replace("/utility/", "/dto/") + StringUtils.capitalize(className) + ".java"); FileOutputStream fop = new FileOutputStream(file); if (!file.exists()) { file.createNewFile(); } byte[] contentInBytes = modelData.getBytes(); fop.write(contentInBytes); fop.flush(); fop.close(); } } public static void genXML(String[] tables, JdbcTemplate jdbcTemplate) throws Exception { Map<String, Object> datamodel = new HashMap<String, Object>(); datamodel.put("tableNames", tables); Map<String, String> query = new HashMap<>(); for (int i = 0; i < tables.length; i++) { query.put(tables[i], InsertStatementGenerator.insertStatement(tables[i], jdbcTemplate)); } datamodel.put("tableQuery", query); String modelData = freemarkerDo(datamodel, "xml.ftl"); try { File file = new File("D:/testfile.xml"); FileOutputStream fop = new FileOutputStream(file); if (!file.exists()) { file.createNewFile(); } byte[] contentInBytes = modelData.getBytes(); fop.write(contentInBytes); fop.flush(); fop.close(); System.out.println("INFO Read Me : Please open " + file + " and follow instructions in comments"); } catch (java.io.FileNotFoundException e) { System.out.println("ERROR : " + e + " Configure file path and file name for XML generation"); } } public static String generateDTOCode(String modelName, String className, JdbcTemplate jdbcTemplate) { try { Map<String, Object> datamodel = new HashMap<String, Object>(); datamodel.put("className", className); datamodel.put("columns", jdbcTemplate.queryForList("SELECT COLUMN_NAME," + "REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(DATA_TYPE,'varchar','String'),'smallint','int'),'bigint','Long'),'bit','boolean')," + "'char','String'),'datetime','Date'),'tinyint','boolean'),'text','String'),'mediumint','int'),'date','Date'),'mediumtext','String'),'longtext','String'),'enum','String'),'mediumString','String'),'longString','String'),'longblob','byte[]') as DATA_TYPE,COLUMN_KEY,IS_NULLABLE " + "FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='school' and table_name = '" + modelName + "'")); return freemarkerDo(datamodel, "dto.ftl"); } catch (Exception e) { e.printStackTrace(); } return ""; } private static String freemarkerDo(Map datamodel, String template) throws Exception { Configuration cfg = new Configuration(); System.out.println(DTOGenerator.class.getResource("").getFile().replace("target/classes", "src/main/java")); cfg.setDirectoryForTemplateLoading(new File(DTOGenerator.class.getResource("").getFile().replace("target/classes", "src/main/java"))); cfg.setObjectWrapper(new DefaultObjectWrapper()); Template temp = cfg.getTemplate(template); StringWriter writer = new StringWriter(); temp.process(datamodel, writer); return writer.toString(); } }
package com.javahunter.taher.dto; import java.util.Date; /** * @author TaherT */ public class ${className?cap_first} { <#list columns as column> private ${column.DATA_TYPE} ${column.COLUMN_NAME}; </#list> <#list columns as column> public ${column.DATA_TYPE} get${column.COLUMN_NAME?cap_first}(){ return ${column.COLUMN_NAME}; } public void set${column.COLUMN_NAME?cap_first}(${column.DATA_TYPE} ${column.COLUMN_NAME}){ this.${column.COLUMN_NAME} = <#if (column.COLUMN_NAME=='oldID')>${columns[0].COLUMN_NAME}<#else>${column.COLUMN_NAME}</#if>; } </#list> @Override public String toString() { return "${className?cap_first} : " + "${columns[0].COLUMN_NAME}=" + ${columns[0].COLUMN_NAME} + "}"; } }
<!--To be added in readquery.properties file at EOF--> <#list tableNames as tableName> read.${tableName}=select * from ${tableName} </#list> <!--To be added in xmlpath.properties--> <#list tableNames as tableName> xml.${tableName}=${"@@@{jobParameters['projectID_folder']}"?replace("@@@", "$")}/${tableName}.xml </#list> <!--To be added in context.xml with bean id="projectUnmarshaller" between <util:map></util:map> at EOF--> <#list tableNames as tableName> <entry key="${tableName}" value="com.javahunter.taher.dto.${tableName?cap_first}" /> </#list> <!--To be added in db-qmetry-reader.xml at the EOF--> <#list tableNames as tableName> <#assign readplacer = "@@@{read.${tableName}}"?replace("@@@", "$")> <bean id="${tableName}DBReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step"> <property name="dataSource" ref="dataSource" /> <property name="sql" value="${readplacer}"/> <property name="rowMapper"> <bean class="org.springframework.jdbc.core.BeanPropertyRowMapper" > <property name="mappedClass" value="com.javahunter.taher.dto.${tableName?cap_first}"></property> </bean> </property> </bean> </#list> <!--To be added in job-qmetry-backup.xml. If table is having heavy data than it should be configured above split(parallelTables) step in sequence remove generated <flow> tag. If table is mid/low than add inside split(parallelTables) at EOF--> <#list tableNames as tableName> <flow> <step id="stepBak${tableName?cap_first}"> <tasklet> <chunk reader="${tableName}DBReader" writer="${tableName}XMLWriter" commit-interval="100" /> </tasklet> </step> </flow> </#list> <!--To be added in xml-qmetry-writer.xml at EOF--> <#list tableNames as tableName> <#assign xmlplacer = "@@@{qmetry.drivelater}@@@{qmetry.docsto}@@@{xml.${tableName}}"?replace("@@@", "$")> <bean id="${tableName}XMLWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter" scope="step"> <property name="resource" value="file:${xmlplacer}" /> <property name="marshaller" ref="projectUnmarshaller" /> <property name="rootTagName" value="${tableName}s" /> </bean> </#list> <!--To be added in writequery.properties at EOF--> <#list tableNames as tableName> write.${tableName}= ${tableQuery[tableName]} </#list> <!--To be added in xml-qmetry-reader.xml at EOF--> <#list tableNames as tableName> <#assign xmlplacer = "@@@{qmetry.drivelater}@@@{qmetry.docsto}@@@{xml.${tableName}}"?replace("@@@", "$")> <bean id="${tableName}XMLReader" class="org.springframework.batch.item.xml.StaxEventItemReader" scope="step"> <property name="resource" value="file:${xmlplacer}" /> <property name="fragmentRootElementName" value="${tableName}" /> <property name="unmarshaller" ref="projectUnmarshaller"/> </bean> </#list> <!--To be added in job-qmetry-restore.xml; need to check table_batch.txt in trunk and find the position where to be placed according to its parent table--> <#list tableNames as tableName> <step id="stepRes${tableName?cap_first}"> <tasklet transaction-manager="transactionManager"> <chunk reader="${tableName}XMLReader" writer="${tableName}DBWriter" commit-interval="100" /> </tasklet> </step> </#list> <!--To be added in db-qmetry-writer.xml at EOF--> <#list tableNames as tableName> <#assign writeplacer = "@@@{write.${tableName}}"?replace("@@@", "$")> <bean id="${tableName}DBWriter" class="org.springframework.batch.item.database.JdbcBatchItemWriter" scope="step"> <property name="dataSource" ref="dataSource" /> <property name="sql" value="${writeplacer}"/> <property name="itemSqlParameterSourceProvider"> <bean class="org.springframework.batch.item.database.BeanPropertyItemSqlParameterSourceProvider" /> </property> </bean> </#list>
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.javahunter.taher.utility; import java.util.List; import java.util.Map; import org.springframework.jdbc.core.JdbcTemplate; /** * * @author taher.tinwala */ public class InsertStatementGenerator { public static void main(String[] args) throws Exception{ System.out.println(insertStatement("project",null)); } public static String insertStatement(String modelName,JdbcTemplate jdbcTemplate) throws Exception { StringBuilder query = new StringBuilder(); List<Map<String, Object>> list = jdbcTemplate.queryForList("SELECT COLUMN_NAME," + "REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(DATA_TYPE,'varchar','String'),'smallint','int'),'bigint','Long'),'bit','boolean')," + "'char','String'),'datetime','Date'),'tinyint','boolean') as DATA_TYPE,COLUMN_KEY " + "FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='"+jdbcTemplate.getDataSource().getConnection().getCatalog()+"' and table_name = '" + modelName + "' AND COLUMN_KEY <> 'PRI'"); query.append("insert into "); query.append(modelName); query.append(" ("); for (Map<String, Object> map : list) { // if(!map.get("COLUMN_KEY").toString().equals("PRI")){ query.append(map.get("COLUMN_NAME")); query.append(","); // } } query.delete(query.length()-1, query.length()); query.append(")"); query.append(" values ("); for (Map<String, Object> map : list) { // if(!map.get("COLUMN_KEY").toString().equals("PRI")){ query.append(":"); query.append(map.get("COLUMN_NAME")); query.append(","); // } } query.delete(query.length()-1, query.length()); query.append(")"); return query.toString(); } }
Read from DataBase Write in XML
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" id="userProps"> <property name="ignoreUnresolvablePlaceholders" value="true"/> <property name="ignoreResourceNotFound" value="true"/> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/> <property name="searchSystemEnvironment" value="true"/> <property name="locations"> <list> <value>classpath*:/props/*.properties</value> </list> </property> </bean> <!-- connect to database --> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="${datasource.url}" /> <property name="username" value="${datasource.username}" /> <property name="password" value="${datasource.password}" /> </bean> <!--Used for FTL POJO generation--> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource" ref="dataSource"/> </bean> <!--create job-meta tables automatically--> <jdbc:initialize-database data-source="dataSource"> <jdbc:script location="org/springframework/batch/core/schema-drop-mysql.sql" /> <jdbc:script location="org/springframework/batch/core/schema-mysql.sql" /> </jdbc:initialize-database> </beans>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- stored job-meta in mysql --> <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"> <property name="transactionManager" ref="transactionManager" /> <property name="dataSource" ref="dataSource" /> <property name="databaseType" value="mysql" /> </bean> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <!-- <bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />--> <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> <property name="jobRepository" ref="jobRepository" /> </bean> <bean id="userUnmarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"> <property name="aliases"> <util:map id="aliases"> <entry key="user" value="com.javahunter.exampit.User" /> <entry key="useraddress" value="com.javahunter.exampit.UserAddress" /> <entry key="userdetail" value="com.javahunter.exampit.UserDetail" /> </util:map> </property> </bean> </beans>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:batch="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"> <import resource="../context.xml" /> <import resource="../database.xml" /> <bean id="userDBReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step"> <property name="dataSource" ref="dataSource" /> <property name="sql" value="${read.project}"/> <property name="rowMapper"> <bean class="org.springframework.jdbc.core.BeanPropertyRowMapper" > <property name="mappedClass" value="com.javahunter.exampit.User"/> <property name="primitivesDefaultedForNullValue" value="true"/> </bean> </property> </bean> <bean id="userDetailDBReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step"> <property name="dataSource" ref="dataSource" /> <property name="sql" value="${read.project}"/> <property name="rowMapper"> <bean class="org.springframework.jdbc.core.BeanPropertyRowMapper" > <property name="mappedClass" value="com.javahunter.exampit.UserDetail"/> <property name="primitivesDefaultedForNullValue" value="true"/> </bean> </property> </bean> <bean id="userAddressDBReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step"> <property name="dataSource" ref="dataSource" /> <property name="sql" value="${read.project}"/> <property name="rowMapper"> <bean class="org.springframework.jdbc.core.BeanPropertyRowMapper" > <property name="mappedClass" value="com.javahunter.exampit.UserAdress"/> <property name="primitivesDefaultedForNullValue" value="true"/> </bean> </property> </bean> <bean id="userXMLWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter" scope="step"> <property name="resource" value="file:${user.drivelater}${xml.user}" /> <property name="marshaller" ref="userUnmarshaller" /> <property name="rootTagName" value="users" /> </bean> <bean id="userDetailXMLWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter" scope="step"> <property name="resource" value="file:${user.drivelater}${xml.userdetail}" /> <property name="marshaller" ref="userUnmarshaller" /> <property name="rootTagName" value="userdetails" /> </bean> <bean id="userAddressXMLWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter" scope="step"> <property name="resource" value="file:${user.drivelater}${xml.useraddress}" /> <property name="marshaller" ref="userUnmarshaller" /> <property name="rootTagName" value="useraddresss" /> </bean> <bean id="taskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/> <job id="UserBackup" xmlns="http://www.springframework.org/schema/batch"> <step id="stepBakUserAddress" next="parallelTables"> <tasklet> <chunk reader="userAddressDBReader" writer="userAddressXMLWriter" commit-interval="10000" /> </tasklet> </step> <split id="parallelTables" task-executor="taskExecutor"> <flow> <step id="stepBakUser"> <tasklet> <chunk reader="userDBReader" writer="userXMLWriter" commit-interval="100" /> </tasklet> </step> </flow> <flow> <step id="stepBakUserDetail"> <tasklet> <chunk reader="userDetailDBReader" writer="userDetailXMLWriter" commit-interval="100" /> </tasklet> </step> </flow> </split> </job> </beans>
read.user=select * from user where userID = #{jobParameters['userID']} read.userdetail=select * from userdetail where userID = #{jobParameters['userID']} read.useraddress=select * from useraddress where userID = #{jobParameters['userID']} xml.user=xml/#{jobParameters['userID']}/user.xml xml.userdetail=xml/#{jobParameters['userID']}/userdetail.xml xml.useraddress=xml/#{jobParameters['userID']}/useraddress.xml
Read from XML Write in DataBase
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:batch="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"> <import resource="../context.xml" /> <import resource="../database.xml" /> <bean id="userXMLReader" class="org.springframework.batch.item.xml.StaxEventItemReader" scope="step"> <property name="resource" value="file:${user.drivelater}${xml.user}" /> <property name="fragmentRootElementName" value="user" /> <property name="unmarshaller" ref="userUnmarshaller"/> </bean> <bean id="userDetailXMLReader" class="org.springframework.batch.item.xml.StaxEventItemReader" scope="step"> <property name="resource" value="file:${user.drivelater}${xml.userdetail}" /> <property name="fragmentRootElementName" value="userdetail" /> <property name="unmarshaller" ref="userUnmarshaller"/> </bean> <bean id="userAddressXMLReader" class="org.springframework.batch.item.xml.StaxEventItemReader" scope="step"> <property name="resource" value="file:${user.drivelater}${xml.useraddress}" /> <property name="fragmentRootElementName" value="useraddress" /> <property name="unmarshaller" ref="userUnmarshaller"/> </bean> <bean id="userDBWriter" class="org.springframework.batch.item.database.JdbcBatchItemWriter" scope="step"> <property name="dataSource" ref="dataSource" /> <property name="sql" value="${write.user}"/> <property name="itemSqlParameterSourceProvider"> <bean class="org.springframework.batch.item.database.BeanPropertyItemSqlParameterSourceProvider" /> </property> </bean> <bean id="userDetailDBWriter" class="org.springframework.batch.item.database.JdbcBatchItemWriter" scope="step"> <property name="dataSource" ref="dataSource" /> <property name="sql" value="${write.userdetail}"/> <property name="itemSqlParameterSourceProvider"> <bean class="org.springframework.batch.item.database.BeanPropertyItemSqlParameterSourceProvider" /> </property> </bean> <bean id="userAddressDBWriter" class="org.springframework.batch.item.database.JdbcBatchItemWriter" scope="step"> <property name="dataSource" ref="dataSource" /> <property name="sql" value="${write.useraddress}"/> <property name="itemSqlParameterSourceProvider"> <bean class="org.springframework.batch.item.database.BeanPropertyItemSqlParameterSourceProvider" /> </property> </bean> <bean id="taskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/> <bean id="itemFailureLoggerListener" class="com.javahunter.exampit.listener.ItemFailureLoggerListener" > <property name="exceptionHandler" ref="exceptionHandler"/> </bean> <job id="userRestore" xmlns="http://www.springframework.org/schema/batch" restartable="true"> <step id="stepResUser" next="detailAndAddress"> <tasklet transaction-manager="transactionManager"> <chunk reader="userXMLReader" writer="userDBWriter" commit-interval="100" skip-limit="99999"> <skippable-exception-classes> <include class="org.springframework.dao.DataIntegrityViolationException"/> <include class="org.springframework.jdbc.BadSqlGrammarException"/> </skippable-exception-classes> </chunk> <listeners> <listener ref="itemFailureLoggerListener"/> </listeners> </tasklet> </step> <split id="detailAndAddress" task-executor="taskExecutor"> <flow> <step id="stepResUserDetail"> <tasklet transaction-manager="transactionManager"> <chunk reader="userDetailXMLReader" writer="userDetailDBWriter" commit-interval="100" skip-limit="99999"> <skippable-exception-classes> <include class="org.springframework.dao.DataIntegrityViolationException"/> <include class="org.springframework.jdbc.BadSqlGrammarException"/> </skippable-exception-classes> </chunk> <listeners> <listener ref="itemFailureLoggerListener"/> </listeners> </tasklet> </step> </flow> <flow> <step id="stepResUserAddress"> <tasklet transaction-manager="transactionManager"> <chunk reader="userAddressXMLReader" writer="userAddressDBWriter" commit-interval="100" skip-limit="99999"> <skippable-exception-classes> <include class="org.springframework.dao.DataIntegrityViolationException"/> <include class="org.springframework.jdbc.BadSqlGrammarException"/> </skippable-exception-classes> </chunk> <listeners> <listener ref="itemFailureLoggerListener"/> </listeners> </tasklet> </step> </flow> </split> </job> </beans>
ul>
write.user=insert into user (username,password,createdOn,isActive,oldId) values (:username,:password,:createdOn,:isActive,:oldId) write.userdetail=insert into userdetail (userId,contact,gender,createdOn,isActive,oldId) values ((select userId from user where oldId=:userId),:contact,:gender,:createdOn,:isActive,:oldId) write.useraddress=insert into useraddress (userId,address,city,pincode,country,createdOn,isActive,oldId) values ((select userId from user where oldId=:userId),:address,:city,:pincode,:country,:createdOn,:isActive,:oldId) #Create POJOs for the above tables
Steps to Configure Spring Liquibase
– Dependency – pom.xml
<dependency> <groupId>org.liquibase</groupId> <artifactId>liquibase-maven-plugin</artifactId> <version>3.4.1</version> </dependency>
– In ApplicationContext.xml Create bean of SpringLiquibase
<bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase"> <property name="dataSource" ref="dataSource" /><!--DataSource cofigs refs related to DB--> <property name="defaultSchema" value="${jdbc.schema.name}" /><!--DB schema name--> <property name="changeLog" value="classpath:dbchanges/db-changelog.xml" /><!--Configuration file for liquibase--> </bean>
– db-changelog.xml
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> <changeSet author="taher.tinwala" id="1" context="pre-process-db-changes" > <sqlFile dbms="postgresql" encoding="utf8" endDelimiter="\nGO" path="/sql-files/project_v1/sqlchanges_1.sql" relativeToChangelogFile="true" splitStatements="true" stripComments="true"/> </changeSet> <changeSet author="java.hunter" id="2" context="pre-process-db-changes"> <sqlFile dbms="postgresql" encoding="utf8" endDelimiter="\nGO" path="/sql-files/project_v1/sqlchanges_2.sql" relativeToChangelogFile="true" splitStatements="true" stripComments="true"/> </changeSet> </databaseChangeLog>
– We have to place sql files in project for above mentioned location(path attribute)
Best site for Learning and Dumps for OCJP.
You will get set of 11 tests which ensures 100% marks in OCJP. All the best
http://www.exampit.com(OCJP Dumps)
ExamPit is a platform for Student and Teacher, where Student can give Free/Paid Test as per the subject of interest and Teacher can earn by creating Test. Also there are Free test on OCJP/SCJP/1Z0-851 for 100% success
(function($) { $.fn.attrs = function() { var attributes = {}; if (this.length) { $.each(this[0].attributes, function(index, attr) { attributes[ attr.name ] = attr.value; }); } return attributes; }; })(jQuery); function makeTest(){ var btnAttr = $('#xyz').attrs(); for(var tt in btnAttr){ console.log(tt+' : '+btnAttr[tt]); } }
<input id="xyz" type="button" onclick="makePDF()" value="Test BTN"/>
save
-Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.)
merge
-Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the session.
flush
-Force this session to flush. Must be called at the end of a unit of work, before committing the transaction and closing the session.Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.
close
-End the session by releasing the JDBC connection and cleaning up. It is not strictly necessary to close the session but you must at least disconnect() it.
evict
-Remove this instance from the session cache. Changes to the instance will not be synchronized with the database.
clear
-Completely clear the session. Evict all loaded instances and cancel all pending saves, updates and deletions. Do not close open iterators or instances of ScrollableResults.
disconnect
-Disconnect the Session from the current JDBC connection. If the connection was obtained by Hibernate close it and return it to the connection pool; otherwise, return it to the application.
persist
-Make a transient instance persistent.
refresh
-Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances. For example
where a database trigger alters the object state upon insert or update
after executing direct SQL (eg. a mass update) in the same session
after inserting a Blob or Clob
get
-Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.)
load
-Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed.
update
-Update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown.
MANDATORY
Support a current transaction, throw an exception if none exists.
NESTED
Execute within a nested transaction if a current transaction exists, behave like PROPAGATION_REQUIRED else.
NEVER
Execute non-transactionally, throw an exception if a transaction exists.
NOT_SUPPORTED
Execute non-transactionally, suspend the current transaction if one exists.
REQUIRED
Support a current transaction, create a new one if none exists.
REQUIRES_NEW
Create a new transaction, suspend the current transaction if one exists.
SUPPORTS
Support a current transaction, execute non-transactionally if none exists.