• Aucun résultat trouvé

Final JEE

N/A
N/A
Protected

Academic year: 2022

Partager "Final JEE"

Copied!
7
0
0

Texte intégral

(1)

2009/2010

Nom, Prénom :

Final JEE

Documents autorisés : Aucun Durée : 1h45.

1)

A quoi correspond le mode AUTOCOMMIT ? Que se passe t-il si on le désactive ? (1 points / 5 minutes)

2)

Que signifie l'acronyme CRUD ?

(0,5 points / 2 minutes)

3)

Quelle est la fonction d'un Data Access Object (je ne demande pas ici les détails d'implémentation) ?

(0,5 points / 2 minutes)

4)

Qu'apporte un framework de persistance type Hibernate par rapport au requétage direct ?

(2 points / 5 minutes)

5)

Que représente un “dialecte” dans le framework Hibernate ?

(0,25 points / 2 minutes)

6)

A quoi correspond la propriété de configuration d'hibernate hbm2ddl.auto ?

(1 points / 5 minutes)

7)

Que se passe t-il si la propriété de configuration hbm2ddl.auto n'est pas renseignée ?

(0,5 points / 2 minutes)

8)

Qu'est de qu'un GENERATOR ?

(0,5 points / 5 minutes)

9)

Compléter les trous matérialisés par des zones surlignées : DAOFactory :

package com.jnesis.model.advert.dao;

import com.jnesis.model.generic.dao.LegalPersonDAO;

public DAOFactory { public ItemDAO getItemDAO();

public RealEstateDAO getRealEstateDAO();

(2)

public CityDAO getCityDAO();

public OptionDAO getOptionDAO();

public getHouseDAO();

public AdvertDAO getAdvertDAO();

public LegalPersonDAO getLegalPersonDAO();

}

HibernateDAOFactory :

package com.jnesis.model.advert.hibernate.dao;

import com.jnesis.model.advert.dao.AdvertDAO;

import com.jnesis.model.advert.dao.ItemDAO;

import com.jnesis.model.advert.dao.CityDAO;

import com.jnesis.model.advert.dao.DAOFactory;

import com.jnesis.model.advert.dao.HouseDAO;

import com.jnesis.model.advert.dao.OptionDAO;

import com.jnesis.model.advert.dao.RealEstateDAO;

import com.jnesis.model.generic.dao.LegalPersonDAO;

import com.jnesis.model.generic.hibernate.dao.HibernateLegalPersonDAO;

public class HibernateDAOFactory { public AdvertDAO getAdvertDAO() {

return new HibernateAdvertDAO();

}

public ItemDAO getItemDAO() {

return new HibernateItemDAO();

}

public RealEstateDAO getRealEstateDAO() {

return new HibernateRealEstateDAO();

}

public CityDAO getCityDAO() {

return new HibernateCityDAO();

}

public OptionDAO getOptionDAO() {

return new HibernateOptionDAO();

}

public getHouseDAO() {

return new ();

}

public LegalPersonDAO getLegalPersonDAO() {

return new HibernateLegalPersonDAO();

} }

HouseDAO :

(3)

package com.jnesis.model.advert.dao;

import com.jnesis.model.advert.bean.House;

import java.util.List;

public HouseDAO {

public List<House> getList() throws DAOException;

public House getById(Long id) throws DAOException;

public void save(House house) throws DAOException;

public void update(House house) throws DAOException;

public void (House house) throws DAOException;

}

HibernateHouseDAO :

package com.jnesis.model.advert.hibernate.dao;

import com.jnesis.model.advert.bean.House;

import com.jnesis.model.advert.dao.DAOException;

import com.jnesis.model.advert.dao.HouseDAO;

import com.jnesis.model.advert.hibernate.util.HibernateUtil;

import java.util.List;

import org.hibernate.HibernateException;

import org.hibernate.Session;

public class HibernateHouseDAO {

public House getById(Long id) throws DAOException {

House house = null;

Session hibernate =

HibernateUtil.getSessionFactory().getCurrentSession();

try {

.beginTransaction();

house = (House) hibernate.get( .class, id);

hibernate.getTransaction(). ; }

catch(HibernateException he) {

if(hibernate.getTransaction() != null) {

hibernate.getTransaction(). ; }

throw new DAOException(he);

}

return house;

}

public void throws DAOException {

Session hibernate =

HibernateUtil.getSessionFactory().getCurrentSession();

try {

.beginTransaction();

(4)

hibernate.save(house);

hibernate.getTransaction(). ; }

catch(HibernateException he) {

if(hibernate.getTransaction() != null) {

hibernate.getTransaction(). ; }

throw new DAOException(he);

} }

public void update(House house) throws DAOException {

Session hibernate =

HibernateUtil.getSessionFactory().getCurrentSession();

try {

.beginTransaction();

hibernate. (house);

hibernate.getTransaction(). ; }

catch(HibernateException he) {

if(hibernate.getTransaction() != null) {

hibernate.getTransaction(). ; }

throw new DAOException(he);

} }

public void delete(House house) throws DAOException {

Session hibernate =

HibernateUtil.getSessionFactory().getCurrentSession();

try {

.beginTransaction();

hibernate.delete( );

hibernate.getTransaction(). ; }

catch(HibernateException he) {

if(hibernate.getTransaction() != null) {

hibernate.getTransaction(). ; }

throw new DAOException(he);

} }

public List<House> getList() throws DAOException {

Session hibernate =

HibernateUtil.getSessionFactory().getCurrentSession();

List<House> houseList = null;

(5)

try {

.beginTransaction();

houseList = hibernate.createQuery(" ").list();

hibernate.getTransaction(). ; }

catch(HibernateException he) {

if(hibernate.getTransaction() != null) {

hibernate.getTransaction(). ; }

throw new DAOException(he);

}

return houseList;

} }

(4,5 points / 10 minutes)

10)

Ecrivez la requête HQL qui, en fonction du

fichier de configuration ci-dessous, permet d'obtenir la liste des villes de plus de 10000 habitants :

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

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<class name="com.jnesis.model.advert.bean.Ville" table="city">

<id name="id" column="id">

<generator class="native" />

</id>

<property name="name" column="name" />

<property name="zipcode" column="zipcode" />

<property name="nbHabitants" column="nb" />

</class>

</hibernate-mapping>

(3,5 points / 5 minutes)

11)

JPA et hibernate sont-ils 2 frameworks

concurrent ? Expliquez ?

(1,5 points / 5 minutes)

12)

Parmi les applications ci-dessous, lesquelles

sont techniquement réalisables et pourquoi ?

Application avec : Hibernate seul + Oracle + Tomcat

Application avec : JPA seul + Oracle + Jboss

Application avec : JPA + Hibernate + Oracle + JBoss

Application avec : JPA + Hibernate + MySQL + JBoss

Application avec : JPA + Toplink + My SQL + JBoss

Application avec : JPA + Hibernate + Toplink + Oracle

Application avec : JPA + Hibernate + Toplink + Oracle + MySQL

(1,75 points / 8 minutes)

(6)

13)

Qu'est ce qu'une unité de persistance ?

(1 points / 2 minutes)

14)

Au minimum, quelles annotations faut-il

ajouter un un Bean pour qu'il puisse être rendu persistant en base de données avec JPA ?

(2 points / 2 minutes)

15)

Qu'est ce que le lazy loading ?

(1 points / 2 minutes)

16)

A quoi correspond la méthode persist() d'un

l'entity manager JPA?

(2 points / 2 minutes)

17)

Quelle est la procédure à mettre en oeuvre

pour mettre à jour en base de données les modification effectuées sur un objet dans l'état “Géré” par le context de persistance ?

(1 points / 1 minute)

18)

Que signifie l'état “Détaché” pour une entité

JPA ?

(0,5 points / 1 minute)

19)

Quels sont les 5 types de relations inter-

entités gérées par JPA ?

(1,25 points / 5 minutes)

20)

A quoi correspond l'annotation JPA

@JoinColumn ?

(0,5 points / 1 minute)

21)

Qu'est ce qu'une relation bidirectionnelle et à

quoi correspond l'attribut JPA MappedBy ?

(2 points / 3 minutes)

22)

En quoi est-ce intéressant d'utiliser le mode de

cascade CascadeType.PERSIST ?

(3 points / 5 minutes)

23)

A quoi correspond l'annotation

@NamedQuery ?

(1 points / 1 minutes)

24)

Comment accède t-on aux méthodes d'un EJB

session ?

(3 points / 10 minutes)

25)

Quels sont les 2 types d'EJB session et en quoi

sont-ils différents ?

(1,5 points / 5 minutes)

26)

Qu'est ce qu'une application d'entreprise et de

quoi est-elle constituée ?

(7)

(2,75 points / 5 minutes)

Références

Documents relatifs

Here we use the definition of authentication that is in use in many (cellular) communication systems [e.g., Global Mobile System (GSM) and wideband code division multiple

Il procède à l’analyse détaillée du fonctionnement des organes dirigeants de la société et relève que la commune « d’une part, ne dispose pas d’un représentant propre

Primary among these is acceptable audio quality resulting from mini- mized network latency (also known as delay) in a mixed voice and data environment. Ethernet, wired or wireless,

 it can register to any Mobile country code (MCC)/Mobile Network Codes (MNC) BTS close to it. =&gt; For example with Orange in France : MCC = “208” and MNC

Look at the picture and complete with is/are and a place preposition: IN FRONT OF, ON, UNDER, BETWEEN, NEXT TO,

The door is raised before the wall (but after the threshold) as the rough and irregular stones must be arranged exactly for the two steps and the lintel. Once the wall is begun,

 La  plupart  interprètent  des  patients,   mais  d'autres  invités  interprètent  des  personnages  des  différentes  histoires

 On  a  pu  notamment  y  retrouver  plusieurs  making-­‐of,  documentaires  et  autres   interviews  ainsi  que  les traditionnels bêtisiers,