Java 为什么Spring在第一次调用存储库方法后关闭Runnable中的DB会话?

Java 为什么Spring在第一次调用存储库方法后关闭Runnable中的DB会话?,java,spring,hibernate,postgresql,jpa,Java,Spring,Hibernate,Postgresql,Jpa,我正在使用JPA(Hibernate作为提供者)和PostgreSQL数据库开发SpringMVC应用程序。我想在后台将(耗时任务的)结果插入数据库,并创建了一个实现Runnable的serviceclass。在run方法中,我从存储库接收一个实体,但是当我尝试访问该实体的惰性集合时,数据库会话已经关闭(我得到一个惰性初始化异常) 我的后台服务的源代码: @Service @Scope("prototype") public class ProjectServiceTestThread impl

我正在使用JPA(Hibernate作为提供者)和PostgreSQL数据库开发SpringMVC应用程序。我想在后台将(耗时任务的)结果插入数据库,并创建了一个实现Runnable的serviceclass。在run方法中,我从存储库接收一个实体,但是当我尝试访问该实体的惰性集合时,数据库会话已经关闭(我得到一个惰性初始化异常)

我的后台服务的源代码:

@Service
@Scope("prototype")
public class ProjectServiceTestThread implements Runnable{

static Logger log = Logger.getLogger(ProjectServiceTestThread.class);

@Autowired
ProjectRepository projectRepository;

@Autowired
ScenarioRepository scenarioRepository;

@Override
@Transactional
public void run() {

    List<Project> projectList = projectRepository.findByName("thread test project");
    Project project;
    project = projectList.get(0);

    //A project can have multiple scenarios
    Scenario scenario;
    if (project.getScenarios().isEmpty()) { //this line fails -> lazyInitializationException - no Session
        System.err.println("Creating new scenario");
        scenario = new Scenario();
        scenario.setName("thread test scenario");
        scenario.setDescription(this + ".runServiceFunction at " + System.currentTimeMillis());
        scenario.setProject(project);
        scenario = scenarioRepository.save(scenario);
    } else {
        System.err.println("Using existing scenario");
        scenario = project.getScenarios().iterator().next();
    }
}    
}
配置:


有人能告诉我为什么它不能这样工作吗?我想出了一些方法让它工作,但我不明白为什么它不能与上面的代码一起工作。这三种方法可以正确插入场景,而不会在其间关闭数据库会话:

  • 从ProjectServiceTestThread中删除@Service并手动在配置中注册bean
  • 未实现Runnable并使用@Async注释ProjectServiceTestThread的run()方法
  • 不使用Spring任务执行器
  • 编辑-项目实体:

    @Entity
    @Table(name = "project", schema = "public", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
    public class Project implements java.io.Serializable {
    
    private int prjid;
    private SimulationModel simulationmodel;
    private String name;
    private String description;
    private String designtarget;
    private Date timehorizon;
    private String location;
    private Date createdon;
    private Date updatedon;
    private Integer createdby;
    private Integer updatedby;
    private Set<ObjectiveFunction> objectivefunctions = new HashSet<ObjectiveFunction>(
            0);
    private Set<Scenario> scenarios = new HashSet<Scenario>(0);
    private Set<ScenarioGenerator> scenariogenerators = new HashSet<ScenarioGenerator>(
            0);
    private List<Component> components = new ArrayList<Component>();
    private Set<OptConstraint> optconstraints = new HashSet<OptConstraint>(0);
    private Set<SearchConstraint> searchconstraints = new HashSet<SearchConstraint>(
            0);
    private Set<Metric> metrics = new HashSet<Metric>(0);
    private Set<UserGroupProject> usergroupprojects = new HashSet<UserGroupProject>(
            0);
    private Set<ExtParam> extparams = new HashSet<ExtParam>(0);
    
    public Project() {
    }
    
    public Project(int prjid, String name) {
        this.prjid = prjid;
        this.name = name;
    }
    
    public Project(int prjid, SimulationModel simulationmodel, String name,
            String description, String designtarget, Date timehorizon, String location,
            Date createdon, Date updatedon, Integer createdby,
            Integer updatedby, Set<ObjectiveFunction> objectivefunctions,
            Set<Scenario> scenarios, Set<ScenarioGenerator> scenariogenerators,
            List<Component> components, Set<OptConstraint> optconstraints,
            Set<SearchConstraint> searchconstraints, Set<Metric> metrics,
            Set<UserGroupProject> usergroupprojects, Set<ExtParam> extparams) {
        this.prjid = prjid;
        this.simulationmodel = simulationmodel;
        this.name = name;
        this.description = description;
        this.designtarget = designtarget;
        this.timehorizon = timehorizon;
        this.location = location;
        this.createdon = createdon;
        this.updatedon = updatedon;
        this.createdby = createdby;
        this.updatedby = updatedby;
        this.objectivefunctions = objectivefunctions;
        this.scenarios = scenarios;
        this.scenariogenerators = scenariogenerators;
        this.components = components;
        this.optconstraints = optconstraints;
        this.searchconstraints = searchconstraints;
        this.metrics = metrics;
        this.usergroupprojects = usergroupprojects;
        this.extparams = extparams;
    }
    
    @SequenceGenerator(name="project_prjid_seq",sequenceName="project_prjid_seq") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="project_prjid_seq")
    @Id
    @Column(name = "prjid", unique = true, nullable = false)
    public int getPrjid() {
        return this.prjid;
    }
    
    public void setPrjid(int prjid) {
        this.prjid = prjid;
    }
    
    @ManyToOne(fetch = FetchType.LAZY,cascade=CascadeType.PERSIST)
    @JoinColumn(name = "modelid")
    public SimulationModel getSimulationmodel() {
        return this.simulationmodel;
    }
    
    public void setSimulationmodel(SimulationModel simulationmodel) {
        this.simulationmodel = simulationmodel;
    }
    
    @Column(name = "name", unique = true, nullable = false, length = 50)
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name = "description")
    public String getDescription() {
        return this.description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    @Column(name = "designtarget", length = 50)
    public String getDesigntarget() {
        return this.designtarget;
    }
    
    public void setDesigntarget(String designtarget) {
        this.designtarget = designtarget;
    }
    
    @Temporal(TemporalType.TIME)
    @Column(name = "timehorizon", length = 15)
    public Date getTimehorizon() {
        return this.timehorizon;
    }
    
    public void setTimehorizon(Date timehorizon) {
        this.timehorizon = timehorizon;
    }
    
    @Column(name = "location")
    public String getLocation() {
        return this.location;
    }
    
    public void setLocation(String location) {
        this.location = location;
    }
    
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "createdon", length = 22)
    public Date getCreatedon() {
        return this.createdon;
    }
    
    public void setCreatedon(Date createdon) {
        this.createdon = createdon;
    }
    
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "updatedon", length = 22)
    public Date getUpdatedon() {
        return this.updatedon;
    }
    
    public void setUpdatedon(Date updatedon) {
        this.updatedon = updatedon;
    }
    
    @Column(name = "createdby")
    public Integer getCreatedby() {
        return this.createdby;
    }
    
    public void setCreatedby(Integer createdby) {
        this.createdby = createdby;
    }
    
    @Column(name = "updatedby")
    public Integer getUpdatedby() {
        return this.updatedby;
    }
    
    public void setUpdatedby(Integer updatedby) {
        this.updatedby = updatedby;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<ObjectiveFunction> getObjectivefunctions() {
        return this.objectivefunctions;
    }
    
    public void setObjectivefunctions(Set<ObjectiveFunction> objectivefunctions) {
        this.objectivefunctions = objectivefunctions;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<Scenario> getScenarios() {
        return this.scenarios;
    }
    
    public void setScenarios(Set<Scenario> scenarios) {
        this.scenarios = scenarios;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<ScenarioGenerator> getScenariogenerators() {
        return this.scenariogenerators;
    }
    
    public void setScenariogenerators(Set<ScenarioGenerator> scenariogenerators) {
        this.scenariogenerators = scenariogenerators;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    @OrderBy("componentid")
    public List<Component> getComponents() {
        return this.components;
    }
    
    public void setComponents(List<Component> components) {
        this.components = components;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<OptConstraint> getOptconstraints() {
        return this.optconstraints;
    }
    
    public void setOptconstraints(Set<OptConstraint> optconstraints) {
        this.optconstraints = optconstraints;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<SearchConstraint> getSearchconstraints() {
        return this.searchconstraints;
    }
    
    public void setSearchconstraints(Set<SearchConstraint> searchconstraints) {
        this.searchconstraints = searchconstraints;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<Metric> getMetrics() {
        return this.metrics;
    }
    
    public void setMetrics(Set<Metric> metrics) {
        this.metrics = metrics;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<UserGroupProject> getUsergroupprojects() {
        return this.usergroupprojects;
    }
    
    public void setUsergroupprojects(Set<UserGroupProject> usergroupprojects) {
        this.usergroupprojects = usergroupprojects;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<ExtParam> getExtparams() {
        return this.extparams;
    }
    
    public void setExtparams(Set<ExtParam> extparams) {
        this.extparams = extparams;
    }
    
    @实体
    @表(name=“project”、schema=“public”、uniqueConstraints=@UniqueConstraint(columnNames=“name”))
    公共类项目实现java.io.Serializable{
    私营机构;
    私有模拟模型;
    私有字符串名称;
    私有字符串描述;
    私有字符串设计目标;
    私有日期时间范围;
    私有字符串位置;
    私人约会;
    私人日期更新;
    创建的私有整数;
    私有整数由更新;
    私有集objectivefunctions=新哈希集(
    0);
    私有集场景=新哈希集(0);
    私有集scenariogenerators=新哈希集(
    0);
    私有列表组件=新的ArrayList();
    私有集optconstraints=新哈希集(0);
    私有集searchconstraints=新哈希集(
    0);
    私有集度量=新哈希集(0);
    私有集usergroupprojects=新哈希集(
    0);
    私有集extparams=新哈希集(0);
    公共工程(){
    }
    公共项目(int prjid,字符串名称){
    this.prjid=prjid;
    this.name=名称;
    }
    公共项目(int-prjid、SimulationModel、SimulationModel、字符串名称、,
    字符串说明、字符串设计目标、日期时间范围、字符串位置、,
    日期createdon,日期UpdateOn,整数createdby,
    整数更新者,Set objectivefunctions,
    设置场景,设置场景生成器,
    列出组件,设置OPT约束,
    设置搜索约束,设置指标,
    设置usergroupprojects,设置extparams){
    this.prjid=prjid;
    this.simulationmodel=模拟模型;
    this.name=名称;
    this.description=描述;
    this.designtarget=设计目标;
    this.timehorizon=timehorizon;
    这个位置=位置;
    this.createdon=createdon;
    this.updatedon=updatedon;
    this.createdby=createdby;
    this.updatedby=updatedby;
    this.objectivefunctions=objectivefunctions;
    这个场景=场景;
    this.scenariogenerators=scenariogenerators;
    这个。组件=组件;
    this.optconstraints=optconstraints;
    this.searchconstraints=searchconstraints;
    这个。度量=度量;
    this.usergroupprojects=usergroupprojects;
    this.extparams=extparams;
    }
    @SequenceGenerator(name=“project_-prjid_-seq”,sequenceName=“project_-prjid_-seq”)@GeneratedValue(策略=GenerationType.SEQUENCE,generator=“project_-prjid_-seq”)
    @身份证
    @列(name=“prjid”,unique=true,nullable=false)
    public int getPrjid(){
    返回此.prjid;
    }
    公共无效设置prjid(内部prjid){
    this.prjid=prjid;
    }
    @manytone(fetch=FetchType.LAZY,cascade=CascadeType.PERSIST)
    @JoinColumn(name=“modelid”)
    公共模拟模型getSimulationmodel(){
    返回此.simulationmodel;
    }
    public void setSimulationmodel(仿真模型仿真模型){
    this.simulationmodel=模拟模型;
    }
    @列(name=“name”,unique=true,nullable=false,length=50)
    公共字符串getName(){
    返回此.name;
    }
    公共void集合名(字符串名){
    this.name=名称;
    }
    @列(name=“description”)
    公共字符串getDescription(){
    返回此.description;
    }
    公共void集合描述(字符串描述){
    this.description=描述;
    }
    @列(name=“designtarget”,长度=50)
    公共字符串getDesigntarget(){
    返回此.designtarget;
    }
    公共void setDesigntarget(字符串designtarget){
    this.designtarget=设计目标;
    }
    @时态(TemporalType.TIME)
    @列(name=“timehorizon”,长度=15)
    公共日期getTimehorizon(){
    返回这个.timehorizon;
    }
    公共无效设置时间范围(日期时间范围){
    this.timehorizon=timehorizon;
    }
    @列(name=“location”)
    公共字符串getLocation(){
    返回此位置;
    }
    公共void集合位置(字符串位置){
    这个位置=位置;
    }
    @时态(TemporalType.TIMESTAMP)
    @列(name=“createdon”,长度=22)
    公共日期getCreatedon(){
    返回这个.createdon;
    }
    public void setCreatedon(日期createdon){
    this.createdon=createdon;
    }
    @时态(TemporalType.TIMESTAMP)
    @列(name=“updatedon”,长度=22)
    公共日期getUpdateOn(){
    返回此.updatedon;
    }
    public void setUpdatedon(Date updatedon){
    this.updatedon=updatedon;
    }
    @列(name=“createdby”)
    公共整数getCreatedby(){
    返回this.createdby;
    }
    公共void setCreatedby(整数createdby){
    this.createdby=createdby;
    }
    @列(name=“updatedby”)
    公共整数getUpdatedby(){
    返回此.updateBy;
    }
    public void setUpdatedby(整数updatedby){
    this.updatedby=updatedby;
    }
    @OneToMany(fetch=FetchType.LAZY,mappedBy=“project”)
    公共集getObjectivefunctions(){
    返回此.objectivefunction
    
    09:50:31,438 TRACE JdbcCoordinatorImpl:525 - Closing prepared statement [select distinct project0_.prjid as prjid1_24_, project0_.createdby as createdb2_24_, project0_.createdon as createdo3_24_, project0_.description as descript4_24_, project0_.designtarget as designta5_24_, project0_.location as location6_24_, project0_.name as name7_24_, project0_.modelid as modelid11_24_, project0_.timehorizon as timehori8_24_, project0_.updatedby as updatedb9_24_, project0_.updatedon as updated10_24_ from public.project project0_ where lower(project0_.name) like ('%'||lower('thread test project')||'%')]
    09:50:31,438 TRACE JdbcCoordinatorImpl:278 - Starting after statement execution processing [ON_CLOSE]
    09:50:31,438 TRACE StatefulPersistenceContext:880 - Initializing non-lazy collections
    09:50:31,439 TRACE SessionImpl:357 - Closing session
    09:50:31,439 TRACE JdbcCoordinatorImpl:199 - Closing JDBC container [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl@3b95a16b]
    09:50:31,439 TRACE LogicalConnectionImpl:178 - Closing logical connection
    09:50:31,439 DEBUG LogicalConnectionImpl:246 - Releasing JDBC connection
    09:50:31,439 DEBUG LogicalConnectionImpl:264 - Released JDBC connection
    09:50:31,442 TRACE LogicalConnectionImpl:190 - Logical connection closed
    09:50:31,445 TRACE TransactionSynchronizationManager:243 - Removed value [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$DefaultCrudMethodMetadata@7cc8f09] for key [public abstract java.util.List eu.cite.repository.ProjectRepository.findByName(java.lang.String)] from thread [myExecutor-1]
    09:50:31,451 TRACE LazyInitializationException:53 - failed to lazily initialize a collection of role: eu.cite.model.Project.scenarios, could not initialize proxy - no Session
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: eu.cite.model.Project.scenarios, could not initialize proxy - no Session
        at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:575)
        at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:214)
        at org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:155)
        at org.hibernate.collection.internal.PersistentSet.isEmpty(PersistentSet.java:166)
        at eu.cite.service.ProjectServiceTestThread.run(ProjectServiceTestThread.java:73)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    
    <context:component-scan base-package="eu.cite.repository, eu.cite.service" scoped-proxy="targetClass" />
    <jpa:repositories base-package="eu.cite.repository" />
    
    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
    
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="punit"/>
        <property name="dataSource" ref="dataSource"></property>
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="showSql" value="true"></property>                   
            </bean>
        </property>
        <property name="jpaPropertyMap">
            <map>
                <entry key="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
                <entry key="hibernate.format_sql" value="true"/>    
                <entry key="hibernate.jdbc.batch_size" value="50"/>                 
                <entry key="hibernate.order_inserts" value="true"/>
            </map>
        </property>
    </bean>
    
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>
    
    <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
    
    <bean id="ModelMapper" class="org.modelmapper.ModelMapper"></bean>
    
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="org.postgresql.Driver"></property>  
        <property name="url" value="jdbc:postgresql://localhost:5432/Cite?autoReconnect=true"></property>
        <property name="username" value="cite"></property>
        <property name="password" value="***"></property>   
    </bean>
    
    <task:executor id="myExecutor"/>
    <task:executor id="myExecutor"  pool-size="5"/>
    
    @Entity
    @Table(name = "project", schema = "public", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
    public class Project implements java.io.Serializable {
    
    private int prjid;
    private SimulationModel simulationmodel;
    private String name;
    private String description;
    private String designtarget;
    private Date timehorizon;
    private String location;
    private Date createdon;
    private Date updatedon;
    private Integer createdby;
    private Integer updatedby;
    private Set<ObjectiveFunction> objectivefunctions = new HashSet<ObjectiveFunction>(
            0);
    private Set<Scenario> scenarios = new HashSet<Scenario>(0);
    private Set<ScenarioGenerator> scenariogenerators = new HashSet<ScenarioGenerator>(
            0);
    private List<Component> components = new ArrayList<Component>();
    private Set<OptConstraint> optconstraints = new HashSet<OptConstraint>(0);
    private Set<SearchConstraint> searchconstraints = new HashSet<SearchConstraint>(
            0);
    private Set<Metric> metrics = new HashSet<Metric>(0);
    private Set<UserGroupProject> usergroupprojects = new HashSet<UserGroupProject>(
            0);
    private Set<ExtParam> extparams = new HashSet<ExtParam>(0);
    
    public Project() {
    }
    
    public Project(int prjid, String name) {
        this.prjid = prjid;
        this.name = name;
    }
    
    public Project(int prjid, SimulationModel simulationmodel, String name,
            String description, String designtarget, Date timehorizon, String location,
            Date createdon, Date updatedon, Integer createdby,
            Integer updatedby, Set<ObjectiveFunction> objectivefunctions,
            Set<Scenario> scenarios, Set<ScenarioGenerator> scenariogenerators,
            List<Component> components, Set<OptConstraint> optconstraints,
            Set<SearchConstraint> searchconstraints, Set<Metric> metrics,
            Set<UserGroupProject> usergroupprojects, Set<ExtParam> extparams) {
        this.prjid = prjid;
        this.simulationmodel = simulationmodel;
        this.name = name;
        this.description = description;
        this.designtarget = designtarget;
        this.timehorizon = timehorizon;
        this.location = location;
        this.createdon = createdon;
        this.updatedon = updatedon;
        this.createdby = createdby;
        this.updatedby = updatedby;
        this.objectivefunctions = objectivefunctions;
        this.scenarios = scenarios;
        this.scenariogenerators = scenariogenerators;
        this.components = components;
        this.optconstraints = optconstraints;
        this.searchconstraints = searchconstraints;
        this.metrics = metrics;
        this.usergroupprojects = usergroupprojects;
        this.extparams = extparams;
    }
    
    @SequenceGenerator(name="project_prjid_seq",sequenceName="project_prjid_seq") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="project_prjid_seq")
    @Id
    @Column(name = "prjid", unique = true, nullable = false)
    public int getPrjid() {
        return this.prjid;
    }
    
    public void setPrjid(int prjid) {
        this.prjid = prjid;
    }
    
    @ManyToOne(fetch = FetchType.LAZY,cascade=CascadeType.PERSIST)
    @JoinColumn(name = "modelid")
    public SimulationModel getSimulationmodel() {
        return this.simulationmodel;
    }
    
    public void setSimulationmodel(SimulationModel simulationmodel) {
        this.simulationmodel = simulationmodel;
    }
    
    @Column(name = "name", unique = true, nullable = false, length = 50)
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name = "description")
    public String getDescription() {
        return this.description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    @Column(name = "designtarget", length = 50)
    public String getDesigntarget() {
        return this.designtarget;
    }
    
    public void setDesigntarget(String designtarget) {
        this.designtarget = designtarget;
    }
    
    @Temporal(TemporalType.TIME)
    @Column(name = "timehorizon", length = 15)
    public Date getTimehorizon() {
        return this.timehorizon;
    }
    
    public void setTimehorizon(Date timehorizon) {
        this.timehorizon = timehorizon;
    }
    
    @Column(name = "location")
    public String getLocation() {
        return this.location;
    }
    
    public void setLocation(String location) {
        this.location = location;
    }
    
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "createdon", length = 22)
    public Date getCreatedon() {
        return this.createdon;
    }
    
    public void setCreatedon(Date createdon) {
        this.createdon = createdon;
    }
    
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "updatedon", length = 22)
    public Date getUpdatedon() {
        return this.updatedon;
    }
    
    public void setUpdatedon(Date updatedon) {
        this.updatedon = updatedon;
    }
    
    @Column(name = "createdby")
    public Integer getCreatedby() {
        return this.createdby;
    }
    
    public void setCreatedby(Integer createdby) {
        this.createdby = createdby;
    }
    
    @Column(name = "updatedby")
    public Integer getUpdatedby() {
        return this.updatedby;
    }
    
    public void setUpdatedby(Integer updatedby) {
        this.updatedby = updatedby;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<ObjectiveFunction> getObjectivefunctions() {
        return this.objectivefunctions;
    }
    
    public void setObjectivefunctions(Set<ObjectiveFunction> objectivefunctions) {
        this.objectivefunctions = objectivefunctions;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<Scenario> getScenarios() {
        return this.scenarios;
    }
    
    public void setScenarios(Set<Scenario> scenarios) {
        this.scenarios = scenarios;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<ScenarioGenerator> getScenariogenerators() {
        return this.scenariogenerators;
    }
    
    public void setScenariogenerators(Set<ScenarioGenerator> scenariogenerators) {
        this.scenariogenerators = scenariogenerators;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    @OrderBy("componentid")
    public List<Component> getComponents() {
        return this.components;
    }
    
    public void setComponents(List<Component> components) {
        this.components = components;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<OptConstraint> getOptconstraints() {
        return this.optconstraints;
    }
    
    public void setOptconstraints(Set<OptConstraint> optconstraints) {
        this.optconstraints = optconstraints;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<SearchConstraint> getSearchconstraints() {
        return this.searchconstraints;
    }
    
    public void setSearchconstraints(Set<SearchConstraint> searchconstraints) {
        this.searchconstraints = searchconstraints;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<Metric> getMetrics() {
        return this.metrics;
    }
    
    public void setMetrics(Set<Metric> metrics) {
        this.metrics = metrics;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<UserGroupProject> getUsergroupprojects() {
        return this.usergroupprojects;
    }
    
    public void setUsergroupprojects(Set<UserGroupProject> usergroupprojects) {
        this.usergroupprojects = usergroupprojects;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<ExtParam> getExtparams() {
        return this.extparams;
    }
    
    public void setExtparams(Set<ExtParam> extparams) {
        this.extparams = extparams;
    }
    
    @Configuration
    @EnableWebMvc
    @ComponentScan({"eu.cite"}) 
    public class appConfig extends WebMvcConfigurerAdapter {