All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clickntap.tool.bean.BeanCreator Maven / Gradle / Ivy

There is a newer version: 1.30
Show newest version
package com.clickntap.tool.bean;

import com.clickntap.tool.jdbc.JdbcManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;

public class BeanCreator implements TransactionCallback {
    private Object bean;

    private BeanInfo beanInfo;

    private JdbcManager jdbcManager;

    public BeanCreator(Object bean, BeanInfo beanInfo, JdbcManager jdbcManager) {
        this.bean = bean;
        this.beanInfo = beanInfo;
        this.jdbcManager = jdbcManager;
    }

    public Object doInTransaction(TransactionStatus status) {
        jdbcManager.updateScript(beanInfo.getCreateScript(), bean);
        String currValScript = beanInfo.getCurrValScript();
        if (currValScript != null)
            return jdbcManager.queryScriptForLong(currValScript, bean);
        else
            return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy