Mantis - Resin
Viewing Issue Advanced Details
2482 minor always 03-03-08 09:18 03-03-08 12:08
ferg  
ferg  
normal  
closed 3.1.5  
fixed  
none    
none 3.1.6  
0002482: @PersistenceContext with EJB
(rep by Matt Johnson)

I've downloaded the latest 3.1.5 and tried again with that version. I am
still getting the same results. I have a quartz job that calls an EJB3.
That bean will persist an object to the database. It looks like the
transaction is committing, but my data never makes it to the database.

Here is the code for my bean:
@PersistenceContext(unitName="npguide")
    private EntityManager em;

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public void grab(String url, Date date) {
        log.info("starting grab");
        Report report = new Report();
        report.setDate(new Date());
        report.setSection("test section");
        report.setText("this is my test text");
        em.persist(report);
        log.info("report: " + report.getId()+" " + report);
    }

The Resin log files show this.

[06:55:52.307] {NPGuideJobsScheduler_Worker-1} Transaction[01:b903dcdb]
begin
 INFO (ReportGrabberBean.java:147) - starting grab
 INFO (ReportGrabberBean.java:153) - report: null
npguide.entity.Report@18c668c[date=Fri Feb 29 06:55:52 CST 2008]
[06:55:52.345] {NPGuideJobsScheduler_Worker-1} Transaction[01:b903dcdb]
committing

So it says the transaction is committing, but I don't see anything in
the database.



Notes
(0002802)
ferg   
03-03-08 12:08   
jpa/213{0,1,2}

(Amber documentation is at http://caucho.com/resin/doc/amber.xtp) [^]