KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > spi > container > BeanStateSynchronization


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.ejb.spi.container;
25
26 import javax.ejb.DuplicateKeyException JavaDoc;
27
28 /**
29  * There are cases where the container would need to interact with the
30  * persistence manager. Some known cases are listed below
31  * 1. provide the user with a mechanism to flush changes to the database
32  * at the end of a method with out waiting until the end of the transaction.
33  * 2. for read only beans provide a mechanism to have the master copy of the bean
34  * sync up with the database record.
35  *
36  * Currently the bean concrete implementation that is created as part of the codegen
37  * would implement this interface.
38  *
39  * @author Pramod Gopinath
40  */

41
42
43 public interface BeanStateSynchronization {
44     /**
45      * Provides a mechanism to flush changes to the database w/o waiting for
46      * the end of the transaction, based on some descriptor values set by the user.
47      * The container would call this method in the postInvoke(), only if the flush
48      * is enabled for the current method and there were no other exceptions set
49      * into inv.exception.
50      */

51     public void ejb__flush()
52         throws DuplicateKeyException JavaDoc;
53
54     /**
55      * On receiving this message the PM would update its master copy
56      * by fetching the latest information for the primary key from the database
57      */

58     public void ejb__refresh(Object JavaDoc primaryKey);
59
60
61     /**
62      * On receiving this message the PM would delete from its master copy
63      * the details related to the primaryKey
64      */

65     public void ejb__remove(Object JavaDoc primaryKey);
66 }
67
Popular Tags