/projects/jboss-5.1.0/testsuite/src/main/org/jboss/test/cmp2/optimisticlock/ejb/CmpEntityBean.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus · Java · 181 lines · 65 code · 16 blank · 100 comment · 0 complexity · a70aca980658f5a12588a93ac7aa9b1f MD5 · raw file

  1. /*
  2. * JBoss, Home of Professional Open Source.
  3. * Copyright 2008, Red Hat Middleware LLC, and individual contributors
  4. * as indicated by the @author tags. See the copyright.txt file in the
  5. * distribution for a full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.jboss.test.cmp2.optimisticlock.ejb;
  23. import javax.ejb.EntityBean;
  24. import javax.ejb.CreateException;
  25. import javax.ejb.RemoveException;
  26. import javax.ejb.EntityContext;
  27. /**
  28. * @ejb.bean
  29. * name="CmpEntity"
  30. * local-jndi-name="local/CmpEntityBean"
  31. * view-type="local"
  32. * type="CMP"
  33. * reentrant="false"
  34. * cmp-version="2.x"
  35. * primkey-field="id"
  36. *
  37. * @jboss.create-table "true"
  38. * @jboss.remove-table "false"
  39. *
  40. * @ejb.finder
  41. * signature="CmpEntityLocal findById(java.lang.Integer id)"
  42. * query="select object(o) from CmpEntity o where o.id=?1"
  43. *
  44. * @author <a href="mailto:aloubyansky@hotmail.com">Alex Loubyansky</a>
  45. */
  46. public abstract class CmpEntityBean
  47. implements EntityBean
  48. {
  49. // Attributes ----------------------------------------
  50. private EntityContext ctx;
  51. // CMP accessors -------------------------------------
  52. /**
  53. * @ejb.pk-field
  54. * @ejb.persistent-field
  55. * @ejb.interface-method
  56. */
  57. public abstract Integer getId();
  58. public abstract void setId(Integer id);
  59. /**
  60. * @ejb.persistent-field
  61. * @ejb.interface-method
  62. */
  63. public abstract String getStringGroup1();
  64. /**
  65. * @ejb.interface-method
  66. */
  67. public abstract void setStringGroup1(String stringField);
  68. /**
  69. * @ejb.persistent-field
  70. * @ejb.interface-method
  71. */
  72. public abstract Integer getIntegerGroup1();
  73. /**
  74. * @ejb.interface-method
  75. */
  76. public abstract void setIntegerGroup1(Integer value);
  77. /**
  78. * @ejb.persistent-field
  79. * @ejb.interface-method
  80. */
  81. public abstract Double getDoubleGroup1();
  82. /**
  83. * @ejb.interface-method
  84. */
  85. public abstract void setDoubleGroup1(Double value);
  86. /**
  87. * @ejb.persistent-field
  88. * @ejb.interface-method
  89. */
  90. public abstract String getStringGroup2();
  91. /**
  92. * @ejb.interface-method
  93. */
  94. public abstract void setStringGroup2(String stringField);
  95. /**
  96. * @ejb.persistent-field
  97. * @ejb.interface-method
  98. */
  99. public abstract Integer getIntegerGroup2();
  100. /**
  101. * @ejb.interface-method
  102. */
  103. public abstract void setIntegerGroup2(Integer value);
  104. /**
  105. * @ejb.persistent-field
  106. * @ejb.interface-method
  107. */
  108. public abstract Double getDoubleGroup2();
  109. /**
  110. * @ejb.interface-method
  111. */
  112. public abstract void setDoubleGroup2(Double value);
  113. /**
  114. * @ejb.persistent-field
  115. * @ejb.interface-method
  116. */
  117. public abstract Long getVersionField();
  118. /**
  119. * @ejb.interface-method
  120. */
  121. public abstract void setVersionField(Long value);
  122. // EntityBean implementation -------------------------
  123. /**
  124. * @ejb.create-method
  125. */
  126. public Integer ejbCreate(Integer id,
  127. String stringGroup1,
  128. Integer integerGroup1,
  129. Double doubleGroup1,
  130. String stringGroup2,
  131. Integer integerGroup2,
  132. Double doubleGroup2)
  133. throws CreateException
  134. {
  135. setId(id);
  136. setStringGroup1(stringGroup1);
  137. setIntegerGroup1(integerGroup1);
  138. setDoubleGroup1(doubleGroup1);
  139. setStringGroup2(stringGroup2);
  140. setIntegerGroup2(integerGroup2);
  141. setDoubleGroup2(doubleGroup2);
  142. return null;
  143. }
  144. public void ejbPostCreate(Integer id,
  145. String stringGroup1,
  146. Integer integerGroup1,
  147. Double doubleGroup1,
  148. String stringGroup2,
  149. Integer integerGroup2,
  150. Double doubleGroup2) {}
  151. public void ejbRemove() throws RemoveException
  152. {}
  153. public void setEntityContext(EntityContext ctx)
  154. {
  155. this.ctx = ctx;
  156. }
  157. public void unsetEntityContext()
  158. {
  159. this.ctx = null;
  160. }
  161. public void ejbActivate() {}
  162. public void ejbPassivate() {}
  163. public void ejbLoad() {}
  164. public void ejbStore() {}
  165. }