This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package example.spring.staticinjection; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.ComponentScan; | |
| import org.springframework.context.annotation.Configuration; | |
| @Configuration | |
| @ComponentScan( basePackageClasses = { UnitOfWorks.class } ) | |
| public class StaticInjectionConfig { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- UnitOfWorkFactory 인스턴스를 UnitOfWorks Singleton의 static field에 설정합니다. --> | |
| <bean name="unitOfWorkInitializer" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> | |
| <property name="staticMethod" value="kr.nsoft.data.hibernate.unitofwork.UnitOfWorks.setUnitOfWorkFactory"/> | |
| <property name="arguments"> | |
| <list> | |
| <ref bean="unitOfWorkFactory"/> | |
| </list> | |
| </property> | |
| </bean> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package example.spring.staticinjection; | |
| public class UnitOfWorks { | |
| private static UnitOfWorkFactory unitOfWorkFactory; | |
| public static void setUnitOfWorkFactory(UnitOfWorkFactory factory) { | |
| unitOfWorkFactory = factory; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package example.spring.staticinjection; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.stereotype.Component; | |
| @Component | |
| public class UnitOfWorks { | |
| private static UnitOfWorkFactory unitOfWorkFactory; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** 지정한 값이 두 속성 값 사이에 존재하는지 여부 */ | |
| public static Criterion getIsInRangeCriterion(final String loPropertyName, | |
| final String hiPropertyName, | |
| Object value, | |
| boolean includeLo, | |
| boolean includeHi) { | |
| Guard.shouldNotBeNull(value, "value"); | |
| Criterion loCriteria = (includeLo) ? le(loPropertyName, value) | |
| : lt(loPropertyName, value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Criterion getIsBetweenCriterion(String propertyName, Object lo, Object hi, | |
| boolean includeLo, boolean includeHi) { | |
| shouldNotBeEmpty(propertyName, "propertyName"); | |
| if (lo == null && hi == null) | |
| throw new IllegalArgumentException("상하한 값 모두 null 이면 안됩니다."); | |
| if (lo != null && hi != null && includeLo && includeHi) | |
| return between(propertyName, lo, hi); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** 지정한 범위 값이 두 속성 값 구간과 겹치는지를 알아보기 위한 질의어 */ | |
| public static Criterion getIsOverlapCriterion(String loPropertyName, | |
| String hiPropertyName, | |
| Object lo, | |
| Object hi, | |
| boolean includeLo, | |
| boolean includeHi) { | |
| if (lo == null && hi == null) | |
| throw new IllegalArgumentException("lo, hi 모두 null 값이면 질의어를 만들 수 없습니다."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright 2011-2013 the original author or authors. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static final String MONGO_OGM_DAO_CLASS_NAME = MongoOgmDao.class.getName(); | |
| @Override | |
| @Bean | |
| @Scope("prototype") | |
| public MongoOgmDao hibernateOgmDao() { | |
| MongoOgmDao dao = Local.get(MONGO_OGM_DAO_CLASS_NAME, MongoOgmDao.class); | |
| if (dao == null) { | |
| dao = new MongoOgmDao(sessionFactory()); | |
| Local.put(MONGO_OGM_DAO_CLASS_NAME, dao); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package kr.debop4j.core; | |
| import com.google.common.collect.Maps; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import java.util.HashMap; | |
| import static kr.debop4j.core.Guard.shouldNotBeNull; |