Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.39 KB | None | 0 0
  1. could not initialize proxy - no Session (through reference chain: java.util.ArrayList[0]->beans.VerificaionCode["patient"]->beans.Patient_$$_jvst40f_7["diabetesType"])
  2.  
  3. @Path("/verificaion_code")
  4. public class VerificationCodeJSONService {
  5.  
  6. @GET
  7. @Path("/getAllVerificationCodes")
  8. @Produces(MediaType.APPLICATION_JSON)
  9. public List<VerificaionCode> getAllVerificationCodes() {
  10.  
  11. VerificationCodeService verificationCodeService=new VerificationCodeService();
  12. List<VerificaionCode> list = verificationCodeService.getAllVerificationCodes();
  13. return list;
  14. }
  15. }
  16.  
  17. public class VerificationCodeService {
  18.  
  19. private static VerificationCodeDAOInterface verificationCodeDAOInterface;
  20.  
  21. public VerificationCodeService() {
  22. verificationCodeDAOInterface = new VerificationCodeDAOImpl();
  23. }
  24.  
  25. public List<VerificaionCode> getAllVerificationCodes() {
  26. Session session = verificationCodeDAOInterface.openCurrentSession();
  27. Transaction transaction = null;
  28.  
  29. List<VerificaionCode> verificaionCodes = new ArrayList<VerificaionCode>();
  30.  
  31. try {
  32. transaction = verificationCodeDAOInterface.openTransaction(session);
  33. verificaionCodes = verificationCodeDAOInterface.getAllVerificationCodes(session);
  34. transaction.commit();
  35. } catch (Exception ex) {
  36. ex.printStackTrace();
  37. } finally {
  38. session.close();
  39. }
  40.  
  41. return verificaionCodes;
  42.  
  43. }
  44. }
  45.  
  46. public class VerificationCodeDAOImpl implements VerificationCodeDAOInterface{
  47.  
  48. private static final SessionFactoryBuilder sessionFactoryBuilder = SessionFactoryBuilder.getInstance();
  49.  
  50. @Override
  51. public List<VerificaionCode> getAllVerificationCodes(Session session) {
  52. List<VerificaionCode> verificaionCodes=(List<VerificaionCode>)session.createQuery("from VerificaionCode").list();
  53. return verificaionCodes;
  54. }
  55. }
  56.  
  57. public class VerificaionCode implements java.io.Serializable {
  58.  
  59. private Integer idverificaionCode;
  60. private Patient patient;
  61. private String code;
  62. private Date dateCreated;
  63. private Date lastUpdated;
  64.  
  65. public VerificaionCode() {
  66. }
  67.  
  68. public VerificaionCode(Patient patient, String code, Date lastUpdated) {
  69. this.patient = patient;
  70. this.code = code;
  71. this.lastUpdated = lastUpdated;
  72. }
  73.  
  74. public VerificaionCode(Patient patient, String code, Date dateCreated, Date lastUpdated) {
  75. this.patient = patient;
  76. this.code = code;
  77. this.dateCreated = dateCreated;
  78. this.lastUpdated = lastUpdated;
  79. }
  80.  
  81. public Integer getIdverificaionCode() {
  82. return this.idverificaionCode;
  83. }
  84.  
  85. public void setIdverificaionCode(Integer idverificaionCode) {
  86. this.idverificaionCode = idverificaionCode;
  87. }
  88.  
  89. public Patient getPatient() {
  90. return this.patient;
  91. }
  92.  
  93. public void setPatient(Patient patient) {
  94. this.patient = patient;
  95. }
  96.  
  97. public String getCode() {
  98. return this.code;
  99. }
  100.  
  101. public void setCode(String code) {
  102. this.code = code;
  103. }
  104.  
  105. public Date getDateCreated() {
  106. return this.dateCreated;
  107. }
  108.  
  109. public void setDateCreated(Date dateCreated) {
  110. this.dateCreated = dateCreated;
  111. }
  112.  
  113. public Date getLastUpdated() {
  114. return this.lastUpdated;
  115. }
  116.  
  117. public void setLastUpdated(Date lastUpdated) {
  118. this.lastUpdated = lastUpdated;
  119. }
  120.  
  121. }
  122.  
  123. public class Patient implements java.io.Serializable {
  124.  
  125. private Integer idpatient;
  126. private DiabetesType diabetesType;
  127. private Language language;
  128. private String customId;
  129. private String diabetesOther;
  130. private String firstName;
  131. private String lastName;
  132. private String email;
  133. private Date dob;
  134. private String parentEmail;
  135. private String gender;
  136. private Date diagnosedDate;
  137. private Double height;
  138. private Double weight;
  139. private String heightUnit;
  140. private String weightUnit;
  141. private String theme;
  142. private String userName;
  143. private String password;
  144. private Date dateCreated;
  145. private Date lastUpdated;
  146.  
  147. public Patient() {
  148. }
  149.  
  150.  
  151. public Patient(DiabetesType diabetesType, Language language, String customId, String firstName, String email, Date dob, String gender, String theme, String userName, String password, Date lastUpdated) {
  152. this.diabetesType = diabetesType;
  153. this.language = language;
  154. this.customId = customId;
  155. this.firstName = firstName;
  156. this.email = email;
  157. this.dob = dob;
  158. this.gender = gender;
  159. this.theme = theme;
  160. this.userName = userName;
  161. this.password = password;
  162. this.lastUpdated = lastUpdated;
  163. }
  164.  
  165. public Integer getIdpatient() {
  166. return this.idpatient;
  167. }
  168.  
  169. public void setIdpatient(Integer idpatient) {
  170. this.idpatient = idpatient;
  171. }
  172. public DiabetesType getDiabetesType() {
  173. return this.diabetesType;
  174. }
  175.  
  176. public void setDiabetesType(DiabetesType diabetesType) {
  177. this.diabetesType = diabetesType;
  178. }
  179. public Language getLanguage() {
  180. return this.language;
  181. }
  182.  
  183. public void setLanguage(Language language) {
  184. this.language = language;
  185. }
  186. public String getCustomId() {
  187. return this.customId;
  188. }
  189.  
  190. public void setCustomId(String customId) {
  191. this.customId = customId;
  192. }
  193. public String getDiabetesOther() {
  194. return this.diabetesOther;
  195. }
  196.  
  197. public void setDiabetesOther(String diabetesOther) {
  198. this.diabetesOther = diabetesOther;
  199. }
  200. public String getFirstName() {
  201. return this.firstName;
  202. }
  203.  
  204. public void setFirstName(String firstName) {
  205. this.firstName = firstName;
  206. }
  207. public String getLastName() {
  208. return this.lastName;
  209. }
  210.  
  211. public void setLastName(String lastName) {
  212. this.lastName = lastName;
  213. }
  214. public String getEmail() {
  215. return this.email;
  216. }
  217.  
  218. public void setEmail(String email) {
  219. this.email = email;
  220. }
  221. public Date getDob() {
  222. return this.dob;
  223. }
  224.  
  225. public void setDob(Date dob) {
  226. this.dob = dob;
  227. }
  228. public String getParentEmail() {
  229. return this.parentEmail;
  230. }
  231.  
  232. public void setParentEmail(String parentEmail) {
  233. this.parentEmail = parentEmail;
  234. }
  235. public String getGender() {
  236. return this.gender;
  237. }
  238.  
  239. public void setGender(String gender) {
  240. this.gender = gender;
  241. }
  242. public Date getDiagnosedDate() {
  243. return this.diagnosedDate;
  244. }
  245.  
  246. public void setDiagnosedDate(Date diagnosedDate) {
  247. this.diagnosedDate = diagnosedDate;
  248. }
  249. public Double getHeight() {
  250. return this.height;
  251. }
  252.  
  253. public void setHeight(Double height) {
  254. this.height = height;
  255. }
  256. public Double getWeight() {
  257. return this.weight;
  258. }
  259.  
  260. public void setWeight(Double weight) {
  261. this.weight = weight;
  262. }
  263. public String getHeightUnit() {
  264. return this.heightUnit;
  265. }
  266.  
  267. public void setHeightUnit(String heightUnit) {
  268. this.heightUnit = heightUnit;
  269. }
  270. public String getWeightUnit() {
  271. return this.weightUnit;
  272. }
  273.  
  274. public void setWeightUnit(String weightUnit) {
  275. this.weightUnit = weightUnit;
  276. }
  277. public String getTheme() {
  278. return this.theme;
  279. }
  280.  
  281. public void setTheme(String theme) {
  282. this.theme = theme;
  283. }
  284. public String getUserName() {
  285. return this.userName;
  286. }
  287.  
  288. public void setUserName(String userName) {
  289. this.userName = userName;
  290. }
  291. public String getPassword() {
  292. return this.password;
  293. }
  294.  
  295. public void setPassword(String password) {
  296. this.password = password;
  297. }
  298. public Date getDateCreated() {
  299. return this.dateCreated;
  300. }
  301.  
  302. public void setDateCreated(Date dateCreated) {
  303. this.dateCreated = dateCreated;
  304. }
  305. public Date getLastUpdated() {
  306. return this.lastUpdated;
  307. }
  308.  
  309. public void setLastUpdated(Date lastUpdated) {
  310. this.lastUpdated = lastUpdated;
  311. }
  312. }
  313.  
  314. <?xml version="1.0"?>
  315. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  316. "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
  317. <!-- Generated Sep 23, 2016 3:21:00 PM by Hibernate Tools 4.3.1 -->
  318. <hibernate-mapping>
  319. <class name="beans.VerificaionCode" table="verificaion_code" catalog="myglukose" optimistic-lock="version">
  320. <id name="idverificaionCode" type="java.lang.Integer">
  321. <column name="idverificaion_code" />
  322. <generator class="identity" />
  323. </id>
  324. <many-to-one name="patient" class="beans.Patient" fetch="select">
  325. <column name="patient_idpatient" not-null="true" />
  326. </many-to-one>
  327. <property name="code" type="string">
  328. <column name="code" length="45" not-null="true" />
  329. </property>
  330. <property name="dateCreated" type="timestamp">
  331. <column name="date_created" length="19" />
  332. </property>
  333. <property name="lastUpdated" type="timestamp">
  334. <column name="last_updated" length="19" not-null="true" />
  335. </property>
  336. </class>
  337. </hibernate-mapping>
  338.  
  339. <?xml version="1.0"?>
  340. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  341. "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
  342. <!-- Generated Sep 23, 2016 3:21:00 PM by Hibernate Tools 4.3.1 -->
  343. <hibernate-mapping>
  344. <class name="beans.Patient" table="patient" catalog="myglukose" optimistic-lock="version">
  345. <id name="idpatient" type="java.lang.Integer">
  346. <column name="idpatient" />
  347. <generator class="identity" />
  348. </id>
  349. <many-to-one name="diabetesType" class="beans.DiabetesType" fetch="select">
  350. <column name="diabetes_type_iddiabetes_type" not-null="true" />
  351. </many-to-one>
  352. <many-to-one name="language" class="beans.Language" fetch="select">
  353. <column name="language_idlanguage" not-null="true" />
  354. </many-to-one>
  355. <property name="customId" type="string">
  356. <column name="custom_id" length="45" not-null="true" />
  357. </property>
  358. <property name="diabetesOther" type="string">
  359. <column name="diabetes_other" length="45" />
  360. </property>
  361. <property name="firstName" type="string">
  362. <column name="first_name" length="100" not-null="true" />
  363. </property>
  364. <property name="lastName" type="string">
  365. <column name="last_name" length="100" />
  366. </property>
  367. <property name="email" type="string">
  368. <column name="email" length="45" not-null="true" />
  369. </property>
  370. <property name="dob" type="date">
  371. <column name="dob" length="10" not-null="true" />
  372. </property>
  373. <property name="parentEmail" type="string">
  374. <column name="parent_email" length="45" />
  375. </property>
  376. <property name="gender" type="string">
  377. <column name="gender" length="45" not-null="true" />
  378. </property>
  379. <property name="diagnosedDate" type="date">
  380. <column name="diagnosed_date" length="10" />
  381. </property>
  382. <property name="height" type="java.lang.Double">
  383. <column name="height" precision="22" scale="0" />
  384. </property>
  385. <property name="weight" type="java.lang.Double">
  386. <column name="weight" precision="22" scale="0" />
  387. </property>
  388. <property name="heightUnit" type="string">
  389. <column name="height_unit" length="45" />
  390. </property>
  391. <property name="weightUnit" type="string">
  392. <column name="weight_unit" length="45" />
  393. </property>
  394. <property name="theme" type="string">
  395. <column name="theme" length="45" not-null="true" />
  396. </property>
  397. <property name="userName" type="string">
  398. <column name="user_name" length="45" not-null="true" />
  399. </property>
  400. <property name="password" type="string">
  401. <column name="password" length="45" not-null="true" />
  402. </property>
  403. <property name="dateCreated" type="timestamp">
  404. <column name="date_created" length="19" />
  405. </property>
  406. <property name="lastUpdated" type="timestamp">
  407. <column name="last_updated" length="19" not-null="true">
  408. <comment>Stores the basic information of the patient</comment>
  409. </column>
  410. </property>
  411. </class>
  412. </hibernate-mapping>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement