반응형

WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.


jdbc:mysql://localhost:3306/Peoples?autoReconnect=true&useSSL=false



반응형

'java' 카테고리의 다른 글

[Java] Date String parsing  (0) 2019.12.18
[Java] Calendar 에 Date 설정하기  (0) 2019.12.18
[java] arraylist, array 간 형변환  (0) 2018.11.22
[Spring] Exception Handler, Parameter  (0) 2018.11.22
[Mybatis] sql include parameter  (0) 2018.11.17
반응형


  • array to arraylist

new ArrayList<>(Arrays.asList(array))


  • arraylist to array

Arrays.copyOf(arrayList.toArray(), arrayList.toArray().length, Object[].class));




반응형

'java' 카테고리의 다른 글

[Java] Calendar 에 Date 설정하기  (0) 2019.12.18
[jdbc][mysql] warn ssl connection  (0) 2018.11.23
[Spring] Exception Handler, Parameter  (0) 2018.11.22
[Mybatis] sql include parameter  (0) 2018.11.17
[Guava] Splitter  (0) 2018.11.17
반응형
  • spring에서는 exception handler를 통해서 예외를 처리할 수가 있다.
    • 그 메소드에 인자를 추가할 수 있는 것들을 정리해보자
    • 임의의 순서로 가질 수 있다
      • An exception argument
      • Request and/or response objects
        • ServletRequest / HttpServletRequest
      • WebRequest or NativeWebRequest
      • InputStream / Reader
      • OutputStream / Writer
      • 등등
    • Response 도 여러가지 가질 수 있음

 @ExceptionHandler(HttpMessageNotReadableException.class)
public ResponseEntity handleHttpMessageNotReadableException(HttpMessageNotReadableException e, WebRequest request) {
    log.debug("{}", request.getDescription);
}



반응형

'java' 카테고리의 다른 글

[jdbc][mysql] warn ssl connection  (0) 2018.11.23
[java] arraylist, array 간 형변환  (0) 2018.11.22
[Mybatis] sql include parameter  (0) 2018.11.17
[Guava] Splitter  (0) 2018.11.17
[Mybatis] selectKey  (0) 2018.11.17
반응형
  • sql로 선언된 sql문을 include 하고 거기에 parameter를 넘길 수 있을까?
    • 안됨
    • 대신 property를 활용해서 넘기자

<sql id="myinclude">
  from ${myproperty}
</sql>

<include refid="myinclude">
  <property name="myproperty" value="tablename"/>
</include>

  • myproperty 에 tablename 값이 들어감 (함수 인자 아님)
    • $ 주의


반응형

'java' 카테고리의 다른 글

[jdbc][mysql] warn ssl connection  (0) 2018.11.23
[java] arraylist, array 간 형변환  (0) 2018.11.22
[Spring] Exception Handler, Parameter  (0) 2018.11.22
[Guava] Splitter  (0) 2018.11.17
[Mybatis] selectKey  (0) 2018.11.17
반응형
  • Spiltter Class
    • on : 전달받은  single-character separator를 사용하는 splitter를 반환한다
    • trimResults: 결과값을 trim
    • split : charsequence를 string components로 split한다. 그리고 lazily evaluated 하는 iterator를 통해서 사용 가능하게 한다.

List<String> list = Splitter.on(separator).trimResults().splitToList(string);


반응형

'java' 카테고리의 다른 글

[jdbc][mysql] warn ssl connection  (0) 2018.11.23
[java] arraylist, array 간 형변환  (0) 2018.11.22
[Spring] Exception Handler, Parameter  (0) 2018.11.22
[Mybatis] sql include parameter  (0) 2018.11.17
[Mybatis] selectKey  (0) 2018.11.17
반응형

데이터를 넣을 때, 기본키를 생성하고 insert 를 하도록 하고 싶을 때가 있다.

이럴 때, 사용할 수 있는 것이 <selectKey> 태그 이다



<insert id="insertUser">
  <selectKey keyProperty="id" resultType="int" order="BEFORE">
    select CAST(RANDOM()*1000000 as INTEGER) a from SYSIBM.SYSDUMMY1
  </selectKey>
  insert into User
    (id, username, password, email,bio, favourite_section)
  values
    (#{id}, #{username}, #{password}, #{email}, #{bio}, #{favouriteSection,jdbcType=VARCHAR})
</insert>

  • #{id} 같은 경우엔 넘어오는 인자에 dummy로 라도 넣어주어야 한다!
    • ex) object 필드 내에 선언
  • selectKey구문이 먼저 실행되고 User id프로퍼티에 셋팅된다. 그리고 나서 insert 구문이 실행된다


반응형

'java' 카테고리의 다른 글

[jdbc][mysql] warn ssl connection  (0) 2018.11.23
[java] arraylist, array 간 형변환  (0) 2018.11.22
[Spring] Exception Handler, Parameter  (0) 2018.11.22
[Mybatis] sql include parameter  (0) 2018.11.17
[Guava] Splitter  (0) 2018.11.17

+ Recent posts