001: /**
002: * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
017: * USA
018: *
019: * Component of: Red Hat Application Server
020: *
021: * Initial Developers: Aizaz Ahmed
022: * Vivek Lakshmanan
023: * Andrew Overholt
024: * Matthew Wringe
025: *
026: */package olstore.entity;
027:
028: import javax.ejb.EntityBean;
029:
030: /**
031: * @ejb.bean name="Property"
032: * description="This bean is used to store extra information about items."
033: * type="CMP"
034: * schema="olstore_properties"
035: * reentrant="false"
036: * cmp-version="2.x"
037: * view-type="local"
038: * local-jndi-name="PropertyLocal_L"
039: *
040: * @ejb.relation
041: * name="Item-Property"
042: * role-name="Property-belongs-to-Item"
043: * cascade-delete="yes"
044: * target-ejb="Item"
045: * target-multiple="yes"
046: *
047: * @ejb.relation
048: * name="Type-Property"
049: * role-name="Property-belongs-to-Type"
050: * cascade-delete="yes"
051: * target-ejb="Type"
052: * target-multiple="yes"
053: *
054: * @ejb.transaction
055: * type="Required"
056: *
057: * @ejb:pk
058: * class="java.lang.Object"
059: * generate="false"
060: *
061: * --
062: * This is needed for JOnAS.
063: * If you are not using JOnAS you can safely remove the tags below.
064: * @jonas.bean ejb-name="Property"
065: * jndi-name="PropertyLocal"
066: * @jonas.jdbc-mapping jndi-name="jdbc_1" jdbc-table-name="olstore_properties"
067: * --
068: *
069: * @ejb.persistence
070: *
071: * @ejb.finder
072: * query="SELECT OBJECT(a) FROM olstore_properties as a"
073: * signature="java.util.Collection findAll()"
074: *
075: * @ejb.finder
076: * query="SELECT OBJECT(a) FROM olstore_properties as a WHERE a.name = ?1"
077: * signature="java.util.Collection findByName(java.lang.String name)"
078: *
079: *--
080: * This is needed for JOnAS.
081: * If you are not using JOnAS you can safely remove the tags below.
082: * @jonas.finder-method-jdbc-mapping method-name="findAll"
083: * jdbc-where-clause=""
084: * @jonas.jdbc-mapping jndi-name="jdbc_1"
085: * jdbc-table-name="olstore_properties"
086: *
087: *--
088: *
089: **/
090:
091: public abstract class PropertyBean implements EntityBean {
092:
093: /**
094: * The ejbCreate method.
095: *
096: * @ejb.create-method
097: */
098: public java.lang.String ejbCreate(String name, String value)
099: throws javax.ejb.CreateException {
100: setName(name);
101: setValue(value);
102: return null;
103: }
104:
105: /**
106: * The container invokes this method immediately after it calls ejbCreate.
107: *
108: */
109: public void ejbPostCreate(String name, String value)
110: throws javax.ejb.CreateException {
111: }
112:
113: /**
114: * Returns the name
115: * @return the name
116: *
117: * @ejb.persistent-field
118: * @ejb.persistence
119: * column-name="name"
120: * sql-type="VARCHAR"
121: *
122: * @ejb.interface-method
123: *
124: */
125: public abstract java.lang.String getName();
126:
127: /**
128: * Sets the name
129: *
130: * @param java.lang.String the new name value
131: *
132: * @ejb.interface-method
133: */
134: public abstract void setName(java.lang.String name);
135:
136: /**
137: * Returns the value
138: * @return the value
139: *
140: * @ejb.persistent-field
141: * @ejb.persistence
142: * column-name="value"
143: * sql-type="VARCHAR"
144: *
145: * @ejb.interface-method
146: *
147: */
148: public abstract java.lang.String getValue();
149:
150: /**
151: * Sets the value
152: *
153: * @param java.lang.String the new value
154: *
155: * @ejb.interface-method
156: */
157: public abstract void setValue(java.lang.String value);
158:
159: }
|