[Day3] JSP/JDBC 3 [10/28]

 

--๋ณต์Šต--
1.  dept ,emp ํ…Œ์ด๋ธ”์—์„œ     
    ๋ถ€์„œ๋ช…์œผ๋กœ ๊ฒ€์ƒ‰ํ•˜์—ฌ  ์†Œ์†๋œ ๋ชจ๋“  ์‚ฌ์› ์ •๋ณด๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ์ฝ”๋”ฉ์„ ํ•˜์„ธ์š”. 
      ใ„ฑ. PreparedStatement ์‚ฌ์šฉ.    
      ใ„ด. ArrayList<EmpDTO> empList ์‚ฌ์šฉ.
      ใ„ท. LIKE ์—ฐ์‚ฐ์ž๋ฅผ ์‚ฌ์šฉ.

public static void main(String[] args) {
	Connection conn = null;
	PreparedStatement pstmt = null;
	ResultSet rs = null;
	ArrayList<EmpDTO> empList = null;
	String pdname = null;
	Scanner scanner = new Scanner(System.in);
	String sql = " SELECT e.* "
			        + " FROM emp e JOIN dept d ON e.deptno = d.deptno "
		        	+ " WHERE d.dname LIKE ? ";  // '%AL%' 
	
	// 
	System.out.print("> ๋ถ€์„œ๋ช… ์ž…๋ ฅ ? ");
	pdname = scanner.next();		
	//
	conn =  DBConn.getConnection();
	try {
		pstmt =  conn.prepareStatement(sql);
		pstmt.setString(1,   String.format("%%%s%%",   pdname.toUpperCase() ) );
		rs = pstmt.executeQuery();
		
		if (  rs.next()) {
			empList = new ArrayList<EmpDTO>();
			do {
				EmpDTO dto = new EmpDTO(
						 rs.getInt("empno") 
						 , rs.getString("ename")
						 , rs.getString("job")
						 , rs.getDate("hiredate")
						 , rs.getInt("mgr")
						 , rs.getDouble("sal")
						 , rs.getDouble("comm")
						 , rs.getInt("deptno"));				 
				empList.add(dto);
			} while ( rs.next() );
		} // if
		
		// printEmp( empList );
		/*
		if( empList == null ) {
			System.out.println(" ์‚ฌ์› ์กด์žฌ X");
		}else {				
		}
		*/
		
		try {
			Iterator<EmpDTO> ir = empList.iterator();
			while (ir.hasNext()) {
				EmpDTO dto = ir.next();
				System.out.println( dto );
			} // while
		} catch (NullPointerException e) {
			System.out.println(" ์‚ฌ์› ์กด์žฌ X ");
		} catch( Exception e) {
			e.printStackTrace();
		} //  
		
	} catch (SQLException e) {
		
		e.printStackTrace();
	} finally {
		try {
			pstmt.close();
			rs.close();
			DBConn.close();
		} catch (SQLException e) { 
			e.printStackTrace();
		} // try			 
	} // try
} // main

 

2. ConnectionString.properties ํŒŒ์ผ์„ Properties ์ปฌ๋ ‰์…˜์„ ์‚ฌ์šฉํ•ด์„œ 

hostname, sid, user, password ์†์„ฑ๊ฐ’์„ ์ฝ์–ด์„œ  DB ์—ฐ๋™ํ•ด์„œ 

HR์˜ departments ํ…Œ์ด๋ธ”์˜ ๋ถ€์„œ ์ •๋ณด๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ์ฝ”๋”ฉ์„ ํ•˜์„ธ์š”.

  ใ„ฑ. PreparedStatement ์‚ฌ์šฉ.

  ใ„ด. ArrayList<DepartmentsDTO> list  ์‚ฌ์šฉ.

  ใ„ท. manager_id ๊ฐ€ NULL ์ธ  ๋ถ€์„œ ์ •๋ณด๋งŒ ์ถœ๋ ฅ.

 

[์‹คํ–‰๊ฒฐ๊ณผ]

[department_id=140, department_name=Control And Credit, manager_id=0, location_id=1700]
[department_id=120, department_name=Treasury, manager_id=0, location_id=1700]
[department_id=130, department_name=Corporate Tax, manager_id=0, location_id=1700]
[department_id=150, department_name=Shareholder Services, manager_id=0, location_id=1700]
[department_id=160, department_name=Benefits, manager_id=0, location_id=1700]
[department_id=170, department_name=Manufacturing, manager_id=0, location_id=1700]
[department_id=180, department_name=Construction, manager_id=0, location_id=1700]
[department_id=190, department_name=Contracting, manager_id=0, location_id=1700]
[department_id=200, department_name=Operations, manager_id=0, location_id=1700]
[department_id=210, department_name=IT Support, manager_id=0, location_id=1700]
[department_id=220, department_name=NOC, manager_id=0, location_id=1700]
[department_id=230, department_name=IT Helpdesk, manager_id=0, location_id=1700]
[department_id=240, department_name=Government Sales, manager_id=0, location_id=1700]
[department_id=250, department_name=Retail Sales, manager_id=0, location_id=1700]
[department_id=260, department_name=Recruiting, manager_id=0, location_id=1700]
[department_id=270, department_name=Payroll, manager_id=0, location_id=1700]

1. ConnectionString.properties ์ˆ˜์ •  hr, lion 

2. DepartmentsDTO ์„ ์–ธ

 

 

public static void main(String[] args) {
	Connection conn = null;
	PreparedStatement pstmt = null;
	ResultSet rs = null;
	ArrayList<DepartmentsDTO> list = null;
		
	String sql = " SELECT *  "
		         	 + " FROM DEPARTMENTS "
		         	 + " WHERE manager_id IS NULL";
	
	// conn = DBConn.getConnection();  scott ๊ณ„์ • ์ ‘์†. 
	
	String dir =  System.getProperty("user.dir");
	// C:\Class\WorkSpace\JdbcClass\jdbcPro
	// System.out.println( dir );		
	Path  path =  Paths.get(dir, "src\\com\\util\\ConnectionString.properties");				
	// System.out.println(  path ); 
	
	Reader reader = null;
	Properties p  = null;
	try {
		reader = new FileReader(  path.toString() );
		p  = new Properties();
		p.load(reader);
	} catch (FileNotFoundException e) { 
		e.printStackTrace();
	} catch (IOException e) { 
		e.printStackTrace();
	} // try
	
	// ์—ฐ๊ฒฐ๋ฌธ์ž์—ด( Connection String )
	String user = p.getProperty("user") ;
	String	password = p.getProperty("password") ;
	String url = p.getProperty("url") ;
	String className = p.getProperty("className") ;		
	//System.out.println( user );
	
	conn =  DBConn.getConnection(url, user, password);
	// oracle.jdbc.driver.T4CConnection@4629104a
	// System.out.println( conn);
	
	try {
		pstmt =  conn.prepareStatement(sql);
		// ? ๋ฐ”์ธ๋”ฉ ๋ณ€์ˆ˜ 
		rs =  pstmt.executeQuery();
		
		if (  rs.next()) {
			list = new ArrayList<DepartmentsDTO>(); 
			do {
				DepartmentsDTO dto = new DepartmentsDTO(
						rs.getInt(1)
						, rs.getString(2)
						, rs.getInt(3)
						, rs.getInt(4));
				list.add(dto);
			} while ( rs.next() );
		} // if
		
		try {
			Iterator<DepartmentsDTO> ir = list.iterator();
			while (ir.hasNext()) {
				DepartmentsDTO dto = ir.next();
				System.out.println( dto );
			} // while
		} catch (NullPointerException e) {
			System.out.println(" ๊ฒฐ๊ณผ๋ฌผ X ");
		} catch( Exception e) {
			e.printStackTrace();
		} //  
		
	} catch (SQLException e) { 
		e.printStackTrace();
	} finally {
		try {
			pstmt.close();
			rs.close();
		} catch (SQLException e) { 
			e.printStackTrace();
		}
	}	
	DBConn.close();
} // main

 


3. HR์˜ jobs ํ…Œ์ด๋ธ”์—์„œ job_id ์ปฌ๋Ÿผ ๋˜๋Š”  job_title ์ปฌ๋Ÿผ์— 
   'RE' ๋˜๋Š” 're' ๋˜๋Š”  'Re' ๋˜๋Š” 'rE' ( ์ฆ‰, ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„ ์—†์ด ) ๋ฌธ์ž์—ด์„ ํฌํ•จํ•˜๋Š” ๋ ˆ์ฝ”๋“œ๋ฅผ 
   ๊ฒ€์ƒ‰ํ•ด์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถœ๋ ฅํ•˜์„ธ์š”. 

JOB_ID            JOB_TITLE   
--------------------------------------------------------------                     
AD_P[RE]S      P[re]sident
AD_VP             Administration Vice P[re]sident
SA_[RE]P        Sales [Re]p[re]sentative
MK_[RE]P       Marketing [Re]p[re]sentative
HR_[RE]P       Human [Re]sources [Re]p[re]sentative
PR_[RE]P        Public [Re]lations [Re]p[re]sentative  

 

public static void main(String[] args) {
	Connection conn = null;
	PreparedStatement pstmt = null;
	ResultSet rs = null;
	ArrayList<JobsDTO> list = null;

	String sql = " SELECT  REGEXP_REPLACE( job_id, 'RE', '[RE]') job_id "
					+ "       , REGEXP_REPLACE( job_title, '(RE|Re|rE|re)', '[\\1]' ) job_title "
					+ " FROM jobs "
					+ " WHERE REGEXP_LIKE( job_id , 'RE' , 'i') OR REGEXP_LIKE( job_title , 'RE' , 'i')";
	
    String dir =  System.getProperty("user.dir"); 
	Path  path =  Paths.get(dir, "src\\com\\util\\ConnectionString.properties");		 
	Reader reader = null;
	Properties p  = null;
    
	try {
		reader = new FileReader(  path.toString() );
		p  = new Properties();
		p.load(reader);
	} catch (FileNotFoundException e) { 
		e.printStackTrace();
	} catch (IOException e) { 
		e.printStackTrace();
	} // try
    
	String user = p.getProperty("user") ;
	String	password = p.getProperty("password") ;
	String url = p.getProperty("url") ;
	String className = p.getProperty("className") ;		 
	conn =  DBConn.getConnection(url, user, password);
	try {
		pstmt =  conn.prepareStatement(sql);
		// ? ๋ฐ”์ธ๋”ฉ ๋ณ€์ˆ˜ 
		rs =  pstmt.executeQuery();
		if (  rs.next()) {
			list = new ArrayList<JobsDTO>(); 
			do {
				JobsDTO dto = new JobsDTO(
					 rs.getString(1)
					, rs.getString(2) 
					, 0
					, 0 );
				list.add(dto);
			} while ( rs.next() );
		} // if
		
        try {
			Iterator<JobsDTO> ir = list.iterator();
			while (ir.hasNext()) {
				JobsDTO dto = ir.next();
				System.out.println( dto );
			} // while
		} catch (NullPointerException e) {
			System.out.println(" ๊ฒฐ๊ณผ๋ฌผ X ");
		} catch( Exception e) {
			e.printStackTrace();
		} //  
	} catch (SQLException e) { 
		e.printStackTrace();
	} finally {
		try {
			pstmt.close();
			rs.close();
		} catch (SQLException e) { 
			e.printStackTrace();
		}
	}
	DBConn.close();
} // main

JOIN ํ•ด์„œ ๋„ฃ์–ด์•ผํ•˜๋Š” DTO๊ฐ€ ํ•„์š”ํ•˜๋‹ค๋ฉด ํ•ด๋‹น๋˜๋Š” ๋ชจ๋“  ์นผ๋Ÿผ์„ ์ €์žฅํ•  DTO๋ฅผ ์„ ์–ธํ•˜๋ฉด ๋จ!

 

public static void main(String[] args) {
	Connection conn = null;
	PreparedStatement pstmt = null;
	ResultSet rs = null;
	DeptEmpSalgradeDTO dto = null;
	ArrayList<DeptEmpSalgradeDTO> list = null;
	String sql =    " SELECT d.deptno, d.dname, empno, ename, hiredate , sal  + NVL(comm, 0) pay , grade "
			+ " FROM dept d RIGHT JOIN emp e ON d.deptno = e.deptno "
			+ "                JOIN salgrade s ON e.sal BETWEEN s.losal AND s.hisal "
			+ " ORDER BY d.deptno ASC      ";  //      ; ์„ธ๋ฏธ์ฝœ๋ก  X
	
	conn = DBConn.getConnection();
	try {
		pstmt = conn.prepareStatement(sql);
		rs = pstmt.executeQuery();
		
		if( rs.next() ) {
			list = new ArrayList<DeptEmpSalgradeDTO>();
			do {
				// deptno,  dname, empno, ename, hiredate ,  pay , grade
				int deptno = rs.getInt(1);
				String dname = rs.getString(2);
				int empno = rs.getInt(3);
				String ename = rs.getString(4);
				Date hiredate = rs.getDate(5);
				double pay = rs.getDouble(6);
				int grade = rs.getInt(7);					
				dto = new DeptEmpSalgradeDTO(deptno, dname, empno, ename, hiredate, pay, grade);					
				list.add(dto);
				
			}while( rs.next() );
		} // if
		
		//
		try {
			Iterator<DeptEmpSalgradeDTO> ir = list.iterator();
			while (ir.hasNext()) {
				dto = ir.next();
				System.out.println( dto );
			} // while
		} catch (NullPointerException e) {
			System.out.println(" ๊ฒฐ๊ณผ๋ฌผ X ");
		} catch( Exception e) {
			e.printStackTrace();
		} //  
	} catch (SQLException e) { 
		e.printStackTrace();
	} finally {
		try {
			pstmt.close();
			rs.close(); 
		} catch (SQLException e) { 
			e.printStackTrace();
		} // try
	} // try
	DBConn.close();	
} // main

 

[์‹คํ–‰๊ฒฐ๊ณผ]

grade       losal   hisal     emp-sal  count(*)
------    --------------  --------- ---------
1๋“ฑ๊ธ‰       (  700~1200 )                   - 2๋ช…
2๋“ฑ๊ธ‰      ( 1201~1400 )                   - 2๋ช…
3๋“ฑ๊ธ‰      ( 1401~2000 )                   - 2๋ช…
4๋“ฑ๊ธ‰      ( 2001~3000 )                  - 4๋ช…
5๋“ฑ๊ธ‰      ( 3001~9999 )                  - 1๋ช…   

 

public static void main(String[] args) {
	Connection conn = null;
	PreparedStatement pstmt = null;
	ResultSet rs = null;		 
	SalgradeDTO dto = null;
	ArrayList<SalgradeDTO> list = null;		 
	String sql = "SELECT grade , losal ,   hisal "
				+ ",  count(*) cnt "
				+ " FROM salgrade s JOIN  emp e ON e.sal BETWEEN s.losal AND s.hisal "
				+ " GROUP BY grade , losal ,   hisal "
				+ " ORDER BY grade ASC";
                
	conn = DBConn.getConnection();
	
    try {
		pstmt = conn.prepareStatement(sql);
		rs = pstmt.executeQuery();
		if( rs.next() ) {
			list = new ArrayList<>();
			do { 
				int grade = rs.getInt(1); 
				int losal = rs.getInt(2); 
				int hisal = rs.getInt(3);					
				int cnt = rs.getInt(4);					
				dto = new SalgradeDTO(grade, losal, hisal, cnt);				
				list.add(dto);
			}while( rs.next() );
		} // if

		try {
			Iterator<SalgradeDTO> ir = list.iterator();
			while (ir.hasNext()) {
				dto = ir.next();
				System.out.println( dto );
			} // while
		} catch (NullPointerException e) {
			System.out.println(" ๊ฒฐ๊ณผ๋ฌผ X ");
		} catch( Exception e) {
			e.printStackTrace();
		} //  
	} catch (SQLException e) { 
		e.printStackTrace();
	} finally {
		try {
			pstmt.close();
			rs.close(); 
		} catch (SQLException e) { 
			e.printStackTrace();
		} // try
	} // try
	DBConn.close();
} // main

 

[์‹คํ–‰๊ฒฐ๊ณผ]

1๋“ฑ๊ธ‰ (     700~1200 ) - 2๋ช…
20 RESEARCH 7369 SMITH 800
30 SALES 7900 JAMES 950

2๋“ฑ๊ธ‰ ( 1201~1400 ) - 2๋ช…

30 SALES 7654 MARTIN 2650
30 SALES 7521 WARD 1750

3๋“ฑ๊ธ‰ ( 1401~2000 ) - 2๋ช…

30 SALES 7499 ALLEN 1900
30 SALES 7844 TURNER 1500

4๋“ฑ๊ธ‰ ( 2001~3000 ) - 4๋ช…

10 ACCOUNTING 7782 CLARK 2450
20 RESEARCH 7902 FORD 3000
20 RESEARCH 7566 JONES 2975
30 SALES 7698 BLAKE 2850

5๋“ฑ๊ธ‰ ( 3001~9999 ) - 1๋ช…   

10 ACCOUNTING 7839 KING 5000
public static void main(String[] args) {
	Connection conn = null;
	PreparedStatement pstmt = null ,  e_pstmt = null;
	ResultSet rs = null, e_rs= null;		 
	SalgradeDTO dto = null;
	ArrayList<SalgradeDTO> list = null;		 
	String sql = "SELECT grade , losal ,   hisal "
				+ ",  count(*) cnt "
				+ " FROM salgrade s JOIN  emp e ON e.sal BETWEEN s.losal AND s.hisal "
				+ " GROUP BY grade , losal ,   hisal "
				+ " ORDER BY grade ASC";
	String sql2 = "SELECT d.deptno, dname, empno, ename, sal , grade "
				+ " FROM dept d RIGHT JOIN emp e ON d.deptno = e.deptno  "
				+ "            JOIN salgrade s ON e.sal BETWEEN s.losal AND s.hisal "
				+ " WHERE grade = ?            ";
	
	//
	conn = DBConn.getConnection();
	try {
		pstmt = conn.prepareStatement(sql);
		rs = pstmt.executeQuery();

		if( rs.next() ) {
			list = new ArrayList<>();
			do { 
				int grade = rs.getInt(1); 
				int losal = rs.getInt(2); 
				int hisal = rs.getInt(3);					
				int cnt = rs.getInt(4);					
				dto = new SalgradeDTO(grade, losal, hisal, cnt);				
				list.add(dto);
				
				// ๋“ฑ๊ธ‰์— ํ•ด๋‹นํ•˜๋Š” ์‚ฌ์› ์ •๋ณด๋ฅผ ์ถœ๋ ฅ. 
				System.out.println(dto);  // 1๋“ฑ๊ธ‰	(  700 ~ 1200 ) - 2๋ช…
				
				e_pstmt = conn.prepareStatement(sql2);
				e_pstmt.setInt(1, grade);
				e_rs = e_pstmt.executeQuery();
				
				if( e_rs.next()		) {
					// ์ปฌ๋ ‰์…˜ ํด๋ž˜์Šค ์ €์žฅ
					do {
						int deptno = e_rs.getInt(1);
						String dname = e_rs.getString(2);
						int empno  = e_rs.getInt(3);
						String ename = e_rs.getString(4);
						double sal = e_rs.getDouble(5);
						
                        System.out.printf("\t\t%d\t%s\t%d\t%s\t%.2f\n", 
                        deptno, dname, empno, ename, sal);
					}while( e_rs.next() );
				}else {
					System.out.println("\t\t ์‚ฌ์› ์กด์žฌ X");
				} // if
				e_pstmt.close(); //
				e_rs.close();       // 
			}while( rs.next() );
				
		} // if
	} catch (SQLException e) { 
		e.printStackTrace();
	} finally {
		try {
			pstmt.close();
			rs.close(); 
		} catch (SQLException e) { 
			e.printStackTrace();
		} // try
	} // try
	DBConn.close();
} // main

 

ํ•˜๋‚˜์˜ [์ปฌ๋ ‰์…˜ํด๋ž˜์Šค]์— ์ €์žฅ : LinkedHashMap

LinkedHashMap<SalgradeDTO, ArrayList<DeptEmpSalgradeDTO>> map 

 

public static void main(String[] args) {
	Connection conn = null;
	PreparedStatement pstmt = null ,  e_pstmt = null;
	ResultSet rs = null, e_rs= null;		 
	SalgradeDTO dto = null;   // key
	ArrayList<DeptEmpSalgradeDTO> list = null; // value
	DeptEmpSalgradeDTO desDto = null;
	LinkedHashMap<SalgradeDTO, ArrayList<DeptEmpSalgradeDTO>> map = null;
	
	String sql = "SELECT grade , losal ,   hisal "
				+ ",  count(*) cnt "
				+ " FROM salgrade s JOIN  emp e ON e.sal BETWEEN s.losal AND s.hisal "
				+ " GROUP BY grade , losal ,   hisal "
				+ " ORDER BY grade ASC";
	String sql2 = "SELECT d.deptno, dname, empno, ename, sal , grade "
				+ " FROM dept d RIGHT JOIN emp e ON d.deptno = e.deptno  "
				+ "            JOIN salgrade s ON e.sal BETWEEN s.losal AND s.hisal "
				+ " WHERE grade = ?            ";

	conn = DBConn.getConnection();
	try {
		pstmt = conn.prepareStatement(sql);
		rs = pstmt.executeQuery();
		if( rs.next() ) {		
			map = new LinkedHashMap<SalgradeDTO, ArrayList<DeptEmpSalgradeDTO>>();
		
			do { 
				int grade = rs.getInt(1); 
				int losal = rs.getInt(2); 
				int hisal = rs.getInt(3);					
				int cnt = rs.getInt(4);			
						
				dto = new SalgradeDTO(grade, losal, hisal, cnt);		// key		
				
				// ๋“ฑ๊ธ‰์— ํ•ด๋‹นํ•˜๋Š” ์‚ฌ์› ์ •๋ณด๋ฅผ ์ถœ๋ ฅ. 
				//System.out.println(dto);  // 1๋“ฑ๊ธ‰	(  700 ~ 1200 ) - 2๋ช…
				list = null;
				
				e_pstmt = conn.prepareStatement(sql2);
				e_pstmt.setInt(1, grade);
				e_rs = e_pstmt.executeQuery();
				
				if( e_rs.next()		) {
					list = new ArrayList<DeptEmpSalgradeDTO>();
					do {
						int deptno = e_rs.getInt(1);
						String dname = e_rs.getString(2);
						int empno  = e_rs.getInt(3);
						String ename = e_rs.getString(4);
						double sal = e_rs.getDouble(5);
								
						//System.out.printf("\t\t%d\t%s\t%d\t%s\t%.2f\n", 
						//		deptno, dname, empno, ename, sal);
								
						desDto = new DeptEmpSalgradeDTO(deptno, dname, empno, ename, null, sal, grade);								
						list.add(desDto);  // value
								
					}while( e_rs.next() );
                    
					map.put(dto, list); // entry ์ถ”๊ฐ€
						
				}// if
				e_pstmt.close(); //
				e_rs.close();       // 
			}while( rs.next() );	
		} // if	
	} catch (SQLException e) { 
			e.printStackTrace();
	} finally {
		try {
			pstmt.close();
			rs.close(); 
		} catch (SQLException e) { 
			e.printStackTrace();
		} // try
	} // try
	DBConn.close();
	printInfo( map );
} // main

private static void printInfo( LinkedHashMap<SalgradeDTO, ArrayList<DeptEmpSalgradeDTO>> map ) {
	Set<Entry<SalgradeDTO, ArrayList<DeptEmpSalgradeDTO>>>  set = map.entrySet();
		
	Iterator<Entry<SalgradeDTO, ArrayList<DeptEmpSalgradeDTO>>> ir = set.iterator();
		
	while (ir.hasNext()) {
		Entry<SalgradeDTO,ArrayList<DeptEmpSalgradeDTO>> entry =  ir.next();
			
		SalgradeDTO key = entry.getKey();
		System.out.println(  key );
			
		ArrayList<DeptEmpSalgradeDTO>  list =  entry.getValue();
		Iterator<DeptEmpSalgradeDTO>  ir2 = list.iterator();
		while (ir2.hasNext()) {
			DeptEmpSalgradeDTO dto =  ir2.next();
			// System.out.printf("\t\t%d\t%s\t%d\t%s\t%.2f\n"
			// ,dto.getDeptno(), dname, empno, ename, sal);
			System.out.println( dto );
		} // while	
	} // while
}

MVC (model view controller) ํŒจํ„ด

 

MVC ํŒจํ„ด

view          : ํ™”๋ฉด

 

+ ์„œ๋น„์Šค    : ๋กœ์ง ์ฒ˜๋ฆฌํ•˜๋Š” ๋ชจ๋ธ๋“ค์„ ํ˜ธ์ถœํ•˜๋Š” ์—ญํ• 

model       : ๊ฒฐ๊ณผ๋ฌผ (๋กœ์ง์ฒ˜๋ฆฌ + ๋ฐ์ดํ„ฐ)                 -> DAO ์š”์ฒญ -> CRUD -> ์˜ค๋ผํด

model       : ๊ฒฐ๊ณผ๋ฌผ (๋กœ์ง์ฒ˜๋ฆฌ + ๋ฐ์ดํ„ฐ)                 -> DAO ์š”์ฒญ -> CRUD -> ์˜ค๋ผํด

model       : ๊ฒฐ๊ณผ๋ฌผ (๋กœ์ง์ฒ˜๋ฆฌ + ๋ฐ์ดํ„ฐ)                 -> DAO ์š”์ฒญ -> CRUD -> ์˜ค๋ผํด


controller : ๋ชจ๋ธ๊ณผ ๋ทฐ ์ƒํ˜ธ์ž‘์šฉ ๊ด€๋ฆฌ

 


                                             

  • ๋„ค์ด๋ฒ„ ๋ธ”๋Ÿฌ๊ทธ ๊ณต์œ ํ•˜๊ธฐ
  • ๋„ค์ด๋ฒ„ ๋ฐด๋“œ์— ๊ณต์œ ํ•˜๊ธฐ
  • ํŽ˜์ด์Šค๋ถ ๊ณต์œ ํ•˜๊ธฐ
  • ์นด์นด์˜ค์Šคํ† ๋ฆฌ ๊ณต์œ ํ•˜๊ธฐ