Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002599 [Resin] minor always 04-14-08 06:09 04-14-08 13:30
Reporter tsv View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.1.5
Summary 0002599: Amber not persisting child enties properly
Description My setup is resin 3.1.5 with mysql database for persistence.

I have a parent entity containing unidirectional child entity.

When i persist the parent, the child does get persisted aswell, but the parent never gets the child ID and thus it is lost.

private void test() {
        Parent p = new Parent();
        
        Child c = new Child();
        c.setName("Elizabeth");
        
        p.setChild(c);
        
        EntityTransaction tx = _manager.getTransaction();
        try {
            tx.begin();
                _manager.persist(p);
            tx.commit();
               
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
        }
        
        System.out.println("Parent: " + p.getId());
        System.out.println("Child : " + p.getChild().getId());
    }

Running the above test yields:

Parent: 1
Child : 1

But in the parent table in the database:
ID Child
1 0


Additional Information Source attached
Attached Files  Parent.java [^] (654 bytes) 04-14-08 06:09
 Child.java [^] (442 bytes) 04-14-08 06:09

- Relationships

- Notes
(0002971)
ferg
04-14-08 13:30

jpa/0o5{0,1}
 

- Issue History
Date Modified Username Field Change
04-14-08 06:09 tsv New Issue
04-14-08 06:09 tsv File Added: Parent.java
04-14-08 06:09 tsv File Added: Child.java
04-14-08 13:30 ferg Note Added: 0002971
04-14-08 13:30 ferg Assigned To  => ferg
04-14-08 13:30 ferg Status new => closed
04-14-08 13:30 ferg Resolution open => fixed
04-14-08 13:30 ferg Fixed in Version  => 3.1.6


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker