어제는 저축성 보험을 들으라고 전화가 와서 처음에는 금융상품인가 해서 한참들었었는데

막상 가입하라고 하며 녹음 하는 순간 저축성 보험이라고 20년만기니 어쩌니 하길래

그냥 끊어버렸는데.


오늘은 뭔 부가서비스같은걸 가입하라고 전화가 오네.

아무조건 없이 리볼빙* 서비스를 해준다길래 알았다고 하고 찾아보니

이월되는 금액은 17%의 이자가 더 붙는다고하네. 쓸일은 없겠지만 조심해야겠다.


그나저나 귀찮네 하나SK카드. 교통비도 할인안되면서.. 전화만 무지하게 오네 개인정보 다 팔아치웠나?

확 해지해버릴까


리볼빙* : 통장에 잔고가 없어 결제금액이 모자랄때 모자른 금액만큼 이월되는 서비스.

'근황' 카테고리의 다른 글

Tech Planet 2016  (0) 2016.10.20
2014 JCO . Java Conference  (0) 2014.02.04
제 13회 한국 자바 개발자 컨퍼런스 (13/02/23)  (0) 2013.02.21
갤넥 젤리빈 GPS 문제  (0) 2012.10.12
신기한글자  (0) 2012.04.03

이것은 iBatis라기 보다는 jaxb 마샬링구현이기는 하나 일단 iBatis변수 맵핑에 중요한 주제이므로 

iBatis로 일단 설명하겠다.

om.manager.vo.vcard.VcardInformation.java

package com.manager.vo.vcard;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="VcardInformation",
		propOrder ={"name","addr","cell","tel","fax","email"})
public class VcardInformation {
	@XmlElement(name="name")
	private String name;
	@XmlElement(name="addr")
	private String addr;
	@XmlElement(name="cell")
	private String cell;
	@XmlElement(name="tel")
	private String tel;
	@XmlElement(name="fax")
	private String fax;
	@XmlElement(name="email")
	private String email;
	
	public VcardInformation(){		
	}
	public VcardInformation(VcardInformation vc){
		this.name = vc.name;
		this.addr = vc.addr;
		this.cell = vc.cell;
		this.tel = vc.tel;
		this.fax = vc.fax;
		this.email = vc.email;		
	}
	public String getName(){
		return this.name;
	}
	public String getAddr(){
		return this.addr;
	}
	public String getCell(){
		return this.cell;
	}
	public String getTel(){
		return this.tel;
	}
	public String getFax(){
		return this.fax;
	}
	public String getEmail(){
		return this.email;
	}
	public void setName(String name){
		this.name = name;
	}
	public void setAddr(String addr){
		this.addr = addr;
	}
	public void setCell(String cell){
		this.cell = cell;
	}
	public void setTel(String tel){
		this.tel= tel;
	}
	public void setFax(String fax){
		this.fax = fax;
	}
	public void setEmail(String email){
		this.email = email;
	}
}


중요한점은 @ 어노테이션 들이다.

@XmlType으로 객체안에 쓰일 변수의 수만큼 propOrder를 순서에 맞게 배열한다.

@XmlElement로 DB수납시 쓰일 변수의 이름을 설정한다. 즉 이 이름이 앞서 나온 #strVar#이 되는것이다.

위의 경우 #name#을 쓰게 되면 String name이 선택되게 된다. 어노테이션을 맞게 써준다면  변수의 이름은 관련없다.

get/set 함수를 알맞게 써줌으로 인해 xxxDAO.xml에서 가져오는 데이터를 원하는곳에 뿌려주고, 전달할수 있게 된다.

ex) setName("정영민") -> .insert호출 #name# 에는 정영민이 담김. 

.select ->VcardInformation객체 받아옴. var= getName()  var에 정영민이 담겨오게됨

(많은부분 생략)






'DB > iBatis' 카테고리의 다른 글

iBatis구현 7 - xxxDAO.java  (0) 2012.03.29
iBatis 구현 - 5 xxxDAO.xml  (0) 2012.03.29
iBatis 구현 - 4 sqlMapConfig.xml  (0) 2012.03.29
iBatis에서 HashMap의 활용  (2) 2012.03.29
iBatis 구현 - 3 xxx-servlet.xml 작성  (0) 2012.03.28

com.manager.dao.sql.VcardDAO.xml




	
	
		
		
		
		
		
		
	
	
	
		insert into VcardTable(name, addr, cell, tel, fax, email)
			values(#name#, #addr#, #cell#, #tel#, #fax#, #email#)
	
	
		update VcardTable
			set addr=#addr#,cell=#cell#,tel=#tel#,fax=#fax#,email=#email#
			where name=#name#
	
	



예제로 설명하겠다.

<sqlMap namespace="vcard">

sqlMap으로 선언되며 

<typeAlias alias="VcardInformation" type="com.manager.vo.vcard.VcardInformation"/>

뒤에있을 resultMap에 사용할 class를 정의한다. 해당클래스에는 Xml파싱을 위한 어노테이션들이 기록되어있다. (다음장에서 설명)

<resultMap id="resultMapVcardInformation" class="VcardInformation">

VcardInformation 클래스의 인자를 sql쿼리에 쓰일 데이터와 맵핑해준다. resultMap은 select문 등 칼럼 맵핑이 필요할때 사용된다.

ex) <result property="varName" column="DB_NAME"/>

varName이라는 변수를 DB_NAME 칼럼에 맵핑

<select id="select" resultMap="resultMapVcardInformation" parameterClass="VcardInformation">

select

name, addr, cell, tel, fax, email

from

VcardTable

</select>

".select"로 호출된다. 

select시  parameterClass는 위에 선언한 resultMap의 class의 선언 어노테이션에 맞는 값을 찾아서 넣는다.

Column  | -> |StringVal

NAME칼럼의 DBVAL1 -> property에 해당하는 class의 어노테이션을찾아맵핑 -> name(변수)로 들어오게 된다.

말이 어려운데 맵핑 맵핑을 잘생각해보면 이해할 수 있다.

구현해보면 더 쉽게 이해할 수 있고..


<insert id="insert" parameterClass="VcardInformation">

insert into VcardTable(name, addr, cell, tel, fax, email)

values(#name#, #addr#, #cell#, #tel#, #fax#, #email#)

</insert>

마찬가지로 ".insert"로 선언된다.

parameterClass에 VcardInformation 객체로 되어있는데 필요한경우 HashMap, String 등 간단하게 사용도 가능하다.

VcardInformation 객체의 내부선언된 어노테이션의 변수에 ##으로 변수를 삽입, sql문에 사용 할 수 있다.


<select id="count" resultClass="Integer">

select count(uid) as total from VcardTable where name=#name#

</select>

위의 예제와 비슷하나 이것은 리턴값이 integer이다. resultClass를 보면 쉽게 구분 가능한데, 갯수를 구하여 리턴해야 하기때문에 굳이  객체선언 등 필요가 없다. 

이번 포스트는 좀.. 많이 난해하다. 남한테 설명하기란 어렵구나


'DB > iBatis' 카테고리의 다른 글

iBatis구현 7 - xxxDAO.java  (0) 2012.03.29
iBatis 구현 - 6 Xml맵핑- .vo.xxx.java  (0) 2012.03.29
iBatis 구현 - 4 sqlMapConfig.xml  (0) 2012.03.29
iBatis에서 HashMap의 활용  (2) 2012.03.29
iBatis 구현 - 3 xxx-servlet.xml 작성  (0) 2012.03.28
xxx-servlet.xml에서 설정한 위치에 해당하는  sqlMap을 설정해야한다.
간단한 설정 예이다.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
  "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
	<settings
		cacheModelsEnabled="true"
		enhancementEnabled="true"
        lazyLoadingEnabled="true"
        maxRequests="32"
        maxSessions="10"
        maxTransactions="5"
        useStatementNamespaces="true"/>
	<sqlMap resource="com/manager/dao/sql/VcardDAO.xml"/>
	
	
</sqlMapConfig>


간단한 설정, 그리고 사용할 sql문의 위치로 구성된다.

위의 경우 VcardDAO.xml에는 프로젝트에서 사용할 sql문이 담겨져있다.

.이 아니라 /로 패키지를 구분한다.



'DB > iBatis' 카테고리의 다른 글

iBatis 구현 - 6 Xml맵핑- .vo.xxx.java  (0) 2012.03.29
iBatis 구현 - 5 xxxDAO.xml  (0) 2012.03.29
iBatis에서 HashMap의 활용  (2) 2012.03.29
iBatis 구현 - 3 xxx-servlet.xml 작성  (0) 2012.03.28
iBatis 구현 - 2 web.xml 수정  (0) 2012.03.28

HashMap은 간단하게 말해 key와 value의 집합이다. 즉 key로 value를 찾아갈수 있게한다.

iBatis에서 적용예로 알아보자.

public void delete(String email, Calendar time) throws Exception {
			Map<String, Object> parameters = new HashMap<String, Objec>();
			parameters.put("calendarTime", time);
			parameters.put("emailAddress", email);
			sqlMapClientTemplate.update(".delete", parameters);
}

위의 경우 인자로 들어온 2개의 파라메터값을 put 한다. 

즉    String  // "calendarTime"  

 Object // time

이 되는것이다. 

이렇게 되면 HashMap에는

String            | Object

calendarTime | time

emailAddress | email

이런 형태로 key | value 쌍의 데이터가 들어간다.


이를 따라서 sqlMap의 .delete 까지 따라들어가면

<sqlMap>
 ~설정~
			<update id="delete" parameterClass="HashMap">
			update
						account
			set
						delete_mark=1,
						modified_time=#calendarTime#
			where
						email_address=#emailAddress#
			</update>
</sqlMap>


왜 쿼리가 delete가 아닌 update인것은 account를 실제 삭제하는것이 아니라 삭제된 것으로 표기하기 때문이다. (정하기나름)

중요한것은 parameterClass가 HashMap으로 들어왔기 때문에 해당 key를 #key#형태로 써줌으로서 내부에 값을 가져올수 있다는 것이다.

여기서는 calendarTime과 emailAddress Key로 소스의 데이터 time과 email 값을 쿼리문에 사용할수 있게되었다.



'DB > iBatis' 카테고리의 다른 글

iBatis 구현 - 5 xxxDAO.xml  (0) 2012.03.29
iBatis 구현 - 4 sqlMapConfig.xml  (0) 2012.03.29
iBatis 구현 - 3 xxx-servlet.xml 작성  (0) 2012.03.28
iBatis 구현 - 2 web.xml 수정  (0) 2012.03.28
iBatis 구현 - 1 대략적 개념  (0) 2012.03.28

GoF 사용 패턴 종류.

Iterator - List의 항목을 찾아 처리

Chain of Reposibility - 값을 넘겨 처리

ex)반환값을 Handler에 넘김. 에러처리에 용이함.

Bridge - Interface와 Impl을 나누어 놓음. 선언과 구현을 분리해놓음으로 유연한 확장성

State - 클래스로 상태를 반환. 그에 따른 처리. 

'java > design_pattern' 카테고리의 다른 글

Design Pattern 기본 원칙  (0) 2014.06.18
Builder Pattern  (0) 2014.06.17
Java Beans Pattern  (0) 2014.06.17
Telescoping Pattern  (0) 2014.06.17
프론트 컨트롤러 패턴  (0) 2013.05.07

Secure CRT를 썼으니 마찬가지로 라이센스 문제로

간단한 터미널 중 가장 유명한 Putty 사용. 설치 조차 필요없이 Putty.exe파일 하나로 실행 

(레지스트리는 등록된다. - 즉 차후 완전한 삭제를 위해서는 레지스트리도 삭제해야한다는것.)

설치 시 수정해야 하는 옵션

1. 출력 라인수를 늘리자 기본이 200으로 설정되어있어 조금만 긴 파일 또는 로그를 볼경우 매우 불편하다. 20000정도로 해도 부담이 없다. (골동컴퓨터제외)

Line of scrollback - 10000으로 수정

2. 글자크기와 창 간격을 수정하자.

- font quality를 clearType으로 

- Gap between text and window edge: 창간격을 3정도로

- Font를 change하여 글자크기와 가독성을 높이자.

Windows폴더에 사설 폰트를 넣어넣을경우 선택이 가능하다. 하지만 라이센스를 조심하자.

3. 파란색과 까만색이 구분이 힘들다. 파란색을 조정해주자.


RGB값을 조정하여 Blue값을 수정해주는게 좋다. 마찬가지로 Blue Bold값도 수정해주자


4. 수정이 끝났으면 초기화면의 Default Setting에 Save로 저장해주자. 그대로 수행하면 1회성으로 끝나게 된다.



참고자료 : http://hajadc.tistory.com/65





'OS > Tool' 카테고리의 다른 글

k8s 강의 후기  (0) 2022.10.25
YouTube 검색 목록 묶어서 재생하기  (0) 2013.10.14
VirtualBox  (0) 2012.08.29
Evernote  (0) 2012.03.28
NotePad++  (0) 2012.03.28

Window - Preferences

Show whitespace characters  체크박스 체크

보여야할 범위 색깔 등도 수정 가능하다. (탭, 띄워쓰기 등)

[샘플코드 : manager-servlet.xml]

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans" 

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:p="http://www.springframework.org/schema/p" 

    xmlns:aop="http://www.springframework.org/schema/aop"

    xmlns:context="http://www.springframework.org/schema/context"

xmlns:tx="http://www.springframework.org/schema/tx"

    xmlns:oxm="http://www.springframework.org/schema/oxm"    

    xsi:schemaLocation="

        http://www.springframework.org/schema/beans 

        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

        http://www.springframework.org/schema/tx    

http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

        http://www.springframework.org/schema/aop 

    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

        http://www.springframework.org/schema/context 

        http://www.springframework.org/schema/context/spring-context-3.0.xsd

        http://www.springframework.org/schema/oxm

     http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">

<context:component-scan base-package="com.manager" />


<tx:annotation-driven transaction-manager="transactionManager"/>

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">

    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>

    <property name="url" value="jdbc:mysql://61.109.146.35:3306/test"/>     

    <property name="username" value="testid"/>

    <property name="password" value="testpwd"/>

    <property name="defaultAutoCommit" value="true"/>

    <property name="initialSize" value="5"/>

    <property name="maxActive" value="30"/>

    <property name="maxIdle" value="5"/>

    <property name="maxWait" value="30000"/>

    <property name="timeBetweenEvictionRunsMillis" value="60000"/>

</bean>

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

        <property name="dataSource" ref="dataSource"/>

    </bean>


    <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">

        <property name="configLocation" value="classpath:config/sqlMapConfig.xml"/>

        <property name="dataSource" ref="dataSource"/>

    </bean>

    

    <bean id="sqlMapClientTemplate"

class="org.springframework.orm.ibatis.SqlMapClientTemplate"

p:sqlMapClient-ref="sqlMapClient"/>

<bean

class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" p:alwaysUseFullPath="true" >

<property name="messageConverters">

<list>

<ref bean="stringHttpMessageConverter" />

<ref bean="marshallingHttpMessageConverter" />

</list>

</property>

</bean>

<bean id="stringHttpMessageConverter"

class="org.springframework.http.converter.StringHttpMessageConverter">

<property name="writeAcceptCharset" value="true" />

</bean>

<bean id="marshallingHttpMessageConverter"

class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter"

p:marshaller-ref="jaxb2Marshaller" p:unmarshaller-ref="jaxb2Marshaller" />

<oxm:jaxb2-marshaller id="jaxb2Marshaller" contextPath="com.manager.vo.vcard"/>

<bean id="viewResolver"

class="org.springframework.web.servlet.view.UrlBasedViewResolver">

<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>

<property name="prefix" value="/WEB-INF/view/"></property>

<property name="suffix" value=".jsp"></property>

</bean>


</beans>

manager-servlet.xml

-- servlet의 모든것이 중요하지만 체크해야 할점을 빨간색 마킹처리했다.

dataSource에는 dbproperties 파일로 빼놓는 경우도 있으나 DB접속 정보를 저장한다.

transactionManager를 선언 하고 DB를 설정한다.

sqlMapClient bean을 선언하고 sqlMapConfig.xml위치를 설정한다. 위의경우 소스폴더의 config패키지 아래에 생성된다.


'DB > iBatis' 카테고리의 다른 글

iBatis 구현 - 4 sqlMapConfig.xml  (0) 2012.03.29
iBatis에서 HashMap의 활용  (2) 2012.03.29
iBatis 구현 - 2 web.xml 수정  (0) 2012.03.28
iBatis 구현 - 1 대략적 개념  (0) 2012.03.28
iBatis 구현 (개인적)  (0) 2012.03.28


<servlet> 부분이 중요. 입력들어오는 주소를 허용하는 범위이다. * 이 아니라 정확한 주소를 치면 그 외의 입력은 모두 무시한다. 

현재는 목록불러들어오기(get), 목록 넣기(insert) 두개의 기능을 쓰기 때문에 *로 지정



'DB > iBatis' 카테고리의 다른 글

iBatis에서 HashMap의 활용  (2) 2012.03.29
iBatis 구현 - 3 xxx-servlet.xml 작성  (0) 2012.03.28
iBatis 구현 - 1 대략적 개념  (0) 2012.03.28
iBatis 구현 (개인적)  (0) 2012.03.28
iBatis란?  (0) 2012.03.28

+ Recent posts