2010/2011 2ème Semestre
Nom, Prénom :
Final JEE
Documents autorisés : Aucun Durée : 1h30.
QUESTIONS DE COURS
Question 1 : A t-on besoin de Servlets pour faire fonctionner Struts 1 ? Expliquez.
(2 points / 5 minutes)
Question 2 : Dans quelles classes fait-on habituellement appel aux DAO dans une application Struts 1 ?
(1 point / 3 minutes)
Question 3 : Expliquez succinctement le mécanisme d'encapsulation de formulaires de Struts 1.
(2 points / 5 minutes)
Question 4 : Si l'on utilise un framework ORM pour gérer toutes les tables d'une base de données, chacune de ces tables bénéficient-elle d'une classe Java à son image ?
Expliquez.
(2 points / 5 minutes)
Question 5 : A quelles problèmatiques de développement courantes permet de répondre un framework ORM ?
(3 points / 5 minutes)
Question 6 : Expliquez les élements en souligné gras du fichier hibernate.cfg.xml qui suit :
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/testDS</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hbm2ddl.auto">create</property>
<mapping resource="titi/toto/Order.hbm.xml"/>
<mapping resource="titi/toto/Client.hbm.xml"/>
</session-factory>
</hibernate-configuration>
(4 points / 8 minutes)
Question 7 : Expliquez le contenu du fichier UserAndClient.hbm.xml qui suit :
<hibernate-mapping>
<class name="com.jnesis.book.entity.User" table="Usr">
<id column="usrname" name="username">
<generator class=”identity”/>
</id>
<property column="pass" name="password" not-null="true"/>
<many-to-one name="collaborateur" unique="true" not-null="false" />
//collaborateur étant de type com.jnesis.book.entity.Client </class>
<class name="com.jnesis.book.entity.Client" table="Client">
<id column="ClientId" name="id">
<generator class="assigned"/>
</id>
<property column="ClientRaisonSociale" length="255" name="raisonSociale" not-null="true"/>
</class>
</hibernate-mapping>
(5 points / 15 minutes)
Question 9 : Que permet le design pattern IOC (Inversion Of Control) ? Spring est-il à votre connaissance le seul composant à mettre en oeuvre ce design pattern ?
(3 points / 5 minutes)
Question 10 : Le fait d'utiliser un ApplicationContext implique t-il obligatoirement que tous les beans en scope singleton soient instanciés dès la création du contexte ?
(2 points / 5 minutes)
Question 11 : Selon vous, un bean en scope singleton a t-il plus de risque de ne pas être Thread Safe qu'un bean en scope prototype ? Pourquoi ?
(3 points / 4 minutes)
Question 12 : Quelle est la différence entre l'autowiring dit 'byName' et celui dit 'byType' ?
(3 points / 5 minutes)
Question 13 : Expliquez la configuration Spring suivante :
<?xml version="1.0" encoding="UTF-8"?>
<beans ...
...">
<import resource="services.xml"/>
<context:annotation-config/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:com/jnesis/props.properties"/>
</bean>
<bean id="myDAO,genericDAO" class="com.jnesis.MyDAO" autowire="byType"/>
<bean name="myService" class="com.jnesis.MyService" scope="prototype">
<property name="dao">
<ref value="myDAO" />
</property>
</bean>
<bean id="globalService" factory-bean="globalServicefactory" factory-method="getService">
<property name="dao">
<ref value="genericDao"/>
</property>
</bean>
<bean id="globalServicefactory" class="com.jnesis.MyFactory">
<property name="options">
<set>
<value>true</value>
<bean class="com.jnesis.Option" p:name="firstRealOption">
<property name="typeName" value="${types.serviceOption}"/>
</bean>
</set>
</property>
</bean>
<bean id="conversionService"
class="org.springframework.format.support.FormattingConversionServiceFactoryBean"/>
</beans>
(6 points / 15 minutes)
Question 14 : Expliquez les annotations présentes dans la classe suivante :
...
@Repository
public class MyClass{
@DateTimeFormat(pattern="dd-MM-yyyy") private Date maDate;
private MySubClass sub;
@Required
public void setMaDate(Date maDate){
this.maDate=maDate;
}
@Resource
public void setSub(MySubClass sub){
this.sub=sub;
} }