전체 글
-
[JPA 2.0] OneToMany 설정하기개발 2014. 9. 30. 10:10
고맙게도 JPA에서 조인을 지원해준다. 일단, USER 테이블, ROLE 테이블이 존재할때 관계를 생각하고... 아래와 같이 정의하면된다. 조인 테이블을 사용할지 안할지는 잘 생각해보고 이용하면 될듯. @Entity@Tablepublic class User implements Serializable {@Id@Column(name = "USER_ID")private String id;@Column(name = "USER_PASSWORD")private String password;@Column(name = "USER_NAME")private String name;@Column(name = "USER_EMAIL")private String email;@Column(name = "USER_MOBILE")pri..
-
[Jackson] NULL 값 표현에 대한 처리개발 2014. 9. 17. 10:28
모델 기반으로 JSON 메시지를 처리하는데 있어서 변수들이 NULL 값을 갖을 수 있는데 이를 JSON에서 표현하기 싫다면? 아래와 같이 처리할 수 있다. 1. ObjectMapper의 메서드로... mapper.setSerializationInclusion(Inclusion.NON_NULL); ObjectMapper mapper = new ObjectMapper(); 2. Annotation 설정으로 @JsonSerialize(include = Inclusion.NON_NULL) OR 매핑하는것보다 그냥 Map으로 처리하는게 더 좋은거 같기도하고... 그때 그때 달라서...ㅋ
-
문자열 한줄씩 읽기개발 2014. 8. 29. 18:31
방법 1. BufferedReader reader = new BufferedReader(new StringReader()); reader.readLine(); 방법2. String[] lines = string.split(System.getProperty("line.separator")); 기타 1. (콘솔로 한줄씩 입력받을 때)Scanner scanner = new Scanner(System.in); while (scanner.hasNextLine()) { String line = scanner.nextLine(); // process the line } scanner.close();
-
Maven Repository 사이트개발 2014. 8. 27. 08:42
https://oss.sonatype.org ex) https://oss.sonatype.org/content/repositories/central/ https://repository.jboss.org/nexus/ ex) https://repository.jboss.org/nexus/content/groups/public/ http://repo.spring.io or https://repo.spring.io 메이븐 프로젝트를 새로 만들고 라이브러리 추가하려면 꼭 검색 못하는 경우가 생김... settings.xml에 한 번만 설정해 두면 되지만... 피치못할 사정으로 개발 노트북을 사용하지 못하면 난감함.. pom.xml 에 repositories 하위에 필요한 주소를 등록해주면됨
-
Tomcat에서 DBCP 사용할 때 Memory leak개발 2014. 5. 9. 12:40
Problem Domain registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. - dbcp, boneCP를 사용하던... 에러는 발생한다. - mySQL, Oracle 관계 없이 에러는 발생한다. - JPA(+ Hibernate)를 사용할 때만 에러가 발생한다. (JPA를 사용하지 않을 때는 에러가 발생하지 않는다.) : org.springframework.orm.jpa.LocalContainerEntityManager..
-