Struts、Hibernate、Spring経典面接試験問題收藏


Hibernate          ? 
  : 
1.          
2.         ,  SessionFactory 
3.  Sesssion 
4.    Transation 
5.      
6.     
7.  Session 
8.  SesstionFactory 

     : 
1.  JDBC            ,                  。 

2. Hibernate     JDBC        ,      ORM  。        DAO       

3. hibernate  Java    ,                。 

4. hibernate      ,          。         。          ,               。 

2. Hibernate       ? 
1. Hibernate2      :a)     b)  (Collection) 

2. Hibernate3              

 Hibernate        ,           ,            ,         ,        ,            ,           。 

3.Hibernate           ?( :   、      ) 

                         ,           ,                  ,          many-to-one、one-to-many、many-to-many、 

4.   Hibernate      

1.       Hibernate       ,          

2.     : 
a)       
b)       
  :          、          、       、           、       
c)          

5. Hibernate      
Sql、Criteria,object comptosition 
Hql: 
1、      
2、     、       
3、      
4、      
5、      

6.     Hibernate? 
1.         ,         
2.            
3.     ,       
4.      ,        
5.       Bag,       Set 
6.           
7.      ,       ,        


7. Struts    ?      Struts? 
    : 
Struts     : 
 web            ActionServlet,ActionServlet  
struts-config.xml         ,             
 ActionServlet          ,       . 
-(1)          ActionMapping  ,     ,           ; 
-(2)  ActionForm     ,     ActionForm  ,             ActionForm   ; 
-(3)                .      ,   ActionForm validate()  ; 
-(4)  ActionForm validate()    null        ActionMessage ActuibErrors  ,          ; 
-(5)ActionServlet  ActionMapping                  Action,      Action     ,        ,    Action execute()  ; 
-(6)Action execute()      ActionForward  ,ActionServlet          ActionForward     JSP  ; 
-(7)ActionForward    JSP        ,     ; 

     : 
JSP、Servlet、JavaBean                        。                ,      ,        、              ,     ,Struts     。 

  Struts      3     :     、    、     

8. Struts validate        ? 
 struts              ,  FormBean  validate()      。 

9.   Struts      
MVC   : web               ActionServler。       ,      ActionForm     ,           ,ActionServler  Struts-config.xml                  ,       ActionForm  Validate()             Action,  Action   ,ActionServlet        ,     Action execute()  。Execute() ActionForm       ,      ,    ActionForward  ,ActionServlet         ActionForward     jsp  ,ActionForward     jsp       ,     。 

10. spring          ? 
1.spring mvc          DispatcherServlet,                             。 
2.DispatcherServlet       HandlerMapping,       Controller. 
3.DispatcherServlet        Controller 
4.Controller         ,     ModelAndView 
5.Dispathcher       ViewResolver     ,  ModelAndView          
6.              。 

    : 
{AOP                  ,       ,              。   AOP  ,     (    、   、   )                ,                  。 
IOC                  ,                。            ,IOC         JNDI。          、     、   (singleton)     (straight construction),                。            (collaborator)。 
Spring    AOP  ,   IOC  。 Spring                。   Spring,    JavaBean             (    )。                         。} 




Spring          ,  7           。Spring            ,         、      bean    ,   1   。 

   Spring        (   )       ,                。         : 

☆     :       Spring        。           BeanFactory,         。BeanFactory        (IOC)                            。 

☆ Spring    :Spring           ,  Spring          。Spring          ,   JNDI、EJB、    、   、       。 

☆ Spring AOP:        ,Spring AOP                    Spring    。  ,        Spring             AOP。Spring AOP       Spring                   。     Spring AOP,     EJB   ,                   。 

☆ Spring DAO:JDBC DAO                 ,                            。             ,                   (         )。Spring DAO     JDBC          DAO       。 

☆ Spring ORM:Spring          ORM   ,      ORM        ,     JDO、Hibernate   iBatis SQL Map。        Spring        DAO       。 

☆ Spring Web   :Web                    ,    Web            。  ,Spring       Jakarta Struts    。Web                              。 

☆ Spring MVC   :MVC             Web       MVC   。      ,MVC            ,MVC          ,     JSP、Velocity、Tiles、iText   POI。 

Spring             J2EE     ,                。Spring       :         J2EE                。    ,           J2EE    (Web   EJB)、      、        。 

IOC   AOP 

      (        )      :     ,           。               ,                     。  (  Spring      IOC   )           。 

     IOC    ,         ,                ,          。      IOC        。 




Spring     IOC        2    3   。 


        

       ,  AOP,       ,                          (         )     。AOP         ,                      。 

AOP   IOC        ,                          。             ,                  Java           。  AOP    ,             ,                     。  ,     Java              ,           。  ,  Spring AOP                。 

AOP           Spring     、              。 

IOC    

Spring        org.springframework.beans  ,         JavaBean       。              ,                     。          BeanFactory   ,           ,             。BeanFactory             。 

BeanFactory         。 

□                       ,            。Singleton               。            。 

□                     。              ,       。 

bean        Spring    IOC      。IOC                     。                ,Spring      JavaBean                    。 

BeanFactory    

   org.springframework.beans.factory.BeanFactory        ,                。     BeanFactory     XmlBeanFactory,    XML          bean,    1   。 

   1. XmlBeanFactory 

BeanFactory factory = new XMLBeanFactory(new FileInputSteam("mybean.xml")); 

  XML        Bean        ,       bean   ,bean         。   BeanFactory    bean,     getBean()   ,        bean      ,    2   。 

   2. getBean() 

MyBean mybean = (MyBean) factory.getBean("mybean"); 

   bean         POJO (     JavaBean        )   FactoryBean。FactoryBean       Spring                    。 

IOC    

                     。          Spring       1        ,        ,        Spring IOC              (          )。 

                 。     ,                   : 

☆         ,           。 

☆         ,      ,                  ,       (      )。 

☆       ,                 。 

     

      ,         ,                      。                  。 

   3. CreditRatingInterface 

public interface CreditRatingInterface { 
public boolean getUserCreditHistoryInformation(ICustomer iCustomer); 
} 

   3                     。             Customer   。         CreditRating     。 

   4. CreditLinkingInterface 

public interface CreditLinkingInterface { 

public String getUrl(); 
public void setUrl(String url); 
public void linkCreditBankAccount() throws Exception ; 

} 

                  (      )     ,           。             ,        getUrl()      。URL   Spring     bean       ,       。         CreditLinking     。 

   5. EmailInterface 

public interface EmailInterface { 

public void sendEmail(ICustomer iCustomer); 
public String getFromEmail(); 
public void setFromEmail(String fromEmail) ; 
public String getPassword(); 
public void setPassword(String password) ; 
public String getSmtpHost() ; 
public void setSmtpHost(String smtpHost); 
public String getUserId() ; 
public void setUserId(String userId);