Guest User

Untitled

a guest
Oct 23rd, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. `<?xml version="1.0" encoding="UTF-8"?>
  2. <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  3. <persistence-unit name="ru.rgups.ui.testSys_JTest-ejb_ejb_1.0-SNAPSHOTPU" transaction-type="JTA">
  4. <jta-data-source>jdbc/__DbConn</jta-data-source
  5. <properties>
  6. <property name="eclipselink.ddl-generation" value="none"/>
  7. <property name="eclipselink.target-server" value="SunAS9"/>
  8. <property name="javax.persistence.jtaDataSource" value="jdbc/__PGDbConn"/>
  9. <property name="eclipselink.logging.level" value="FINE"/>
  10. <property name="eclipselink.logging.level.sql" value="FINE"/>
  11. <property name="eclipselink.logging.parameters" value="true"/>
  12. </properties>
  13. </persistence-unit>
  14. </persistence>`
  15.  
  16. @Stateless
  17. public class TryFacade extends AbstractFacade<Try> {
  18. @PersistenceContext(unitName = "JTest-ejb_1.0-SNAPSHOTPU")
  19. private EntityManager em;
  20. @EJB
  21. private TryQuestionFacade tryQuestionF;
  22. .
  23. .
  24. .
  25. @TransactionAttribute(TransactionAttributeType.SUPPORTS)
  26. public Try findByID(Integer studId) {
  27. try {
  28. if (studId != null) {
  29. Try sst = em.createNamedQuery("Try.findByIdz", Try.class)
  30. .setParameter("idz", studId)
  31. .getSingleResult();
  32. return sst;
  33. }
  34. } catch (Exception ex) {
  35. ex.printStackTrace(System.err);
  36. }
  37. return null;
  38. }
  39. .
  40. .
  41. .
  42.  
  43. @Named("tryController")
  44. @SessionScoped
  45. public class TryController implements Serializable {
  46.  
  47. @EJB
  48. private TryFacade ejbFacade;
  49.  
  50. .
  51. .
  52. .
  53. public Try getTryByIdz(Integer id) {
  54. if (id != null) {
  55. selected=getFacade().findByID(id);
  56. return getSelected();
  57. }
  58. return null;
  59. }
  60.  
  61. .
  62. .
  63. .
Add Comment
Please, Sign In to add comment