These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: J'espère m'être bien expliqué!!! Interface CRUD
PostPosted: Thu Jul 27, 2006 8:38 am 
Newbie

Joined: Tue Jul 25, 2006 10:36 pm
Posts: 3
Location: Morocco
Bonjour à tous,

Je souhaiterais savoir comment créer des CRUD.
Je m'explique :
J'aimerais créer un interface java englobe toutes les opérations CRUD (create,read,...) sur un objet .
J'espère m'être bien expliqué.
Rq: j'ai déja développé des classes bean permet d'ajouter et d'afficher mais j'aimerais bien avoir une explication sur la méthodoligie de création interface CRUD

Merci d'avance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 9:36 am 
Newbie

Joined: Wed Apr 12, 2006 6:07 am
Posts: 4
Refère toi à la doc hibernate : Generic Data Access Objects
à l'adresse : http://www.hibernate.org/328.html

En voici un extrait :
"This is a pattern for Data Access Objects with JDK 5.0, from the CaveatEmptor example application. Two links you might find useful: Sessions and transactions and Open Session in View.

This time I based the DAO example on interfaces. Tools like Hibernate already provide database portability, so persistence layer portability shouldn't be a driving motivation for interfaces. However, DAO interfaces make sense in more complex applications, when several persistence services are encapsulate in one persistence layer, and they deserve more than a note (which was all I did in HiA first edition).
The DAO interfaces

I use one interface per persistent entity, with a super interface for common CRUD functionality:

public interface GenericDAO<T, ID extends Serializable> {

T findById(ID id, boolean lock);

List<T> findAll();

List<T> findByExample(T exampleInstance);

T makePersistent(T entity);

void makeTransient(T entity);
}

You can already see that this is going to be a pattern for a state-oriented data access API, with methods such as makePersistent() and makeTransient(). Furthermore, to implement a DAO you have to provide a type and an identifier argument. As for most ORM solutions, identifier types have to be serializable. [...]"

ça devrait te contenter. je crois. si j'ai compris la question.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.