Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `<?xml version="1.0" encoding="UTF-8"?>
- <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">
- <persistence-unit name="ru.rgups.ui.testSys_JTest-ejb_ejb_1.0-SNAPSHOTPU" transaction-type="JTA">
- <jta-data-source>jdbc/__DbConn</jta-data-source
- <properties>
- <property name="eclipselink.ddl-generation" value="none"/>
- <property name="eclipselink.target-server" value="SunAS9"/>
- <property name="javax.persistence.jtaDataSource" value="jdbc/__PGDbConn"/>
- <property name="eclipselink.logging.level" value="FINE"/>
- <property name="eclipselink.logging.level.sql" value="FINE"/>
- <property name="eclipselink.logging.parameters" value="true"/>
- </properties>
- </persistence-unit>
- </persistence>`
- @Stateless
- public class TryFacade extends AbstractFacade<Try> {
- @PersistenceContext(unitName = "JTest-ejb_1.0-SNAPSHOTPU")
- private EntityManager em;
- @EJB
- private TryQuestionFacade tryQuestionF;
- .
- .
- .
- @TransactionAttribute(TransactionAttributeType.SUPPORTS)
- public Try findByID(Integer studId) {
- try {
- if (studId != null) {
- Try sst = em.createNamedQuery("Try.findByIdz", Try.class)
- .setParameter("idz", studId)
- .getSingleResult();
- return sst;
- }
- } catch (Exception ex) {
- ex.printStackTrace(System.err);
- }
- return null;
- }
- .
- .
- .
- @Named("tryController")
- @SessionScoped
- public class TryController implements Serializable {
- @EJB
- private TryFacade ejbFacade;
- .
- .
- .
- public Try getTryByIdz(Integer id) {
- if (id != null) {
- selected=getFacade().findByID(id);
- return getSelected();
- }
- return null;
- }
- .
- .
- .
Add Comment
Please, Sign In to add comment