-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: insert silently fails
PostPosted: Mon Jul 03, 2006 4:52 pm 
Newbie

Joined: Mon Jul 03, 2006 4:28 pm
Posts: 15
Hibernate version:3.2.0.cr2

Mapping documents:Using annotations

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs: no exceptions, silent failure

Name and version of the database you are using: derby (via netbeans)

The generated SQL (show_sql=true): see log

Debug level Hibernate log excerpt: level at debug, log below


Hi All,

I'm having a bit of trouble using ejb 3 and annotations with hibernate. I have everything set up and working fine for one object, however for another object I get a silent failure (the transaction commits fine without exceptions, but there is no data in the table).

The following code in one of my servlets works fine (and the user is added):


Code:
        try{                       
            txn.begin();           
            String hashedPassword = hashSHA1("admin");           
            EntityManager manager = emf.createEntityManager();
            User u = new User("Admin", "Admin", "admin", hashedPassword, "admin@test.com");
            u.addOperation(Operation.CREATE_PROJECT);
            manager.persist(u);
            txn.commit();
            request.getRequestDispatcher("/Login.jsp").forward(request, response);           
        }catch(Exception e){
            log.error("Error creating administrator.", e);
            try{
                txn.rollback();           
            }catch(SystemException exc){ throw new ServletException(e); }
            throw new ServletException(e);
        }   


In the above, the user object is added fine (user object below):

Code:
@Entity
@Table (name="FFUser")
public class User implements Serializable {

    /**
     * The id.
     */
    @Id
    @GeneratedValue
    private Integer id;
   
    /**
     * The username.
     */
    @Column(unique=true)
    private String username;
   
    /**
     * The roles assigned to this user.
     */
    @OneToMany
    private Collection<Role> roles = new ArrayList<Role>();
   
    /**
     * The allowed operations assigned to this user.
     */
    @CollectionOfElements
    private Collection<Operation> allowedOperations = new ArrayList<Operation>();
       
    /**
     * The first name.
     */
    @Column
    private String firstName;
   
    /**
     * The second name.
     */
    @Column
    private String lastName;
   
    /**
     * The email address.
     */
    @Column
    private String emailAddress;

    /**
     * The password hash.
     */
    @Column
    private String passwordHash;
   
    @Column
    private double costPerHour;
   
    @Column
    private double plantCostsPerHour;
   
    @Column
    private double otherCostsPerHour;
   
    /**
     * Creates a new instance of User
     */
    public User() {
    }
   
    /**
     * Creates a new user.
     *
     * @param   firstName       The first name.
     * @param   lastName        The last name.
     * @param   username        The username.
     * @param   password        The password.
     */
    public User(String firstName, String lastName, String username, String passwordHash, String emailAddress){
        this.firstName = firstName;
        this.lastName = lastName;
        this.username = username;
        this.passwordHash = passwordHash;
        this.emailAddress = emailAddress;
    }

    /**
     * Gets the username.
     * @return The username.
     */
    public String getUsername(){
        return username;
    }
   
    /**
     * Sets the username.
     *
     * @param   username        The username.
     */
    public void setUsername(String username){
        this.username = username;
    }

    /**
     * Gets the roles assigned to this user.
     * @return The roles.
     */
    public Collection<Role> getRoles() {
        return roles;
    }

    /**
     * Sets the roles assigned to this user.
     *
     * @param   roles       The roles.
     */
    public void setRoles(Collection<Role> roles) {
        this.roles = roles;
    }

    /**
     * Gets the allowed operations for this user.
     * @return The operations this user can execute.
     */
    public Collection<Operation> getAllowedOperations() {
        return allowedOperations;
    }

    /**
     * Sets the allowed operations for this user.
     *
     * @param   allowedOperations       The operations this user can execute.
     */
    public void setAllowedOperations(Collection<Operation> allowedOperations) {
        this.allowedOperations = allowedOperations;
    }

    /**
     * Gets the first name for this user.
     * @return The first name.
     */
    public String getFirstName() {
        return firstName;
    }

    /**
     * Sets the first name.
     * @param firstName The first name.
     */
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    /**
     * Gets the last name.
     * @return The last name.
     */
    public String getLastName() {
        return lastName;
    }

    /**
     * Sets the last name.
     * @param lastName The last name.
     */
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    /**
     * Gets the email address.
     * @return The email address.
     */
    public String getEmailAddress() {
        return emailAddress;
    }

    /**
     * Sets the email address.
     * @param emailAddress The email address.
     */
    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

    /**
     * Gets the password hash.
     * @return The password hash.
     */
    public String getPasswordHash() {
        return passwordHash;
    }

    /**
     * Sets the password hash.
     * @param passwordHash The password hash.
     */
    public void setPasswordHash(String passwordHash) {
        this.passwordHash = passwordHash;
    }
   
    /**
     * Checks to see if this user can execute the supplied operation.
     * @param operation The operation to check for.
     * @return True if the user can execute the supplied operation, false otherwise.
     */
    public boolean canExecute(Operation operation){
        if(getAllowedOperations().contains(operation)) return true;
        for(Role role : roles){
            if(role.canExecute(operation)) return true;
        }
        return false;
    }   
   
    /**
     * Standard toString() implementation.
     * @return A string representation of this object.
     */
    @Override
    public String toString() {
        return lookupToString("User") + lookupToString("Spacer") + getUsername();
    }       
   
    /**
     * Equals method implementation.
     * @param obj The object to test equality against.
     * @return true if the two objects are equal, false otherwise.
     */
    @Override   
    public boolean equals(Object obj){
        try{
            if(username == null)
                return new EqualsBuilder()
                    .reflectionEquals(obj, this);
            else return username == ((User)obj).getUsername();
        }catch(ClassCastException e){
            return false;
        }
    }
   
    /**
     * Hashcode method implementation.
     * @return The hashcode for this object.
     */
    public int hashCode(){
        return new HashCodeBuilder().reflectionHashCode(this);
    }       

    /**
     * Gets the id.
     *
     * @returns The id.
     */
    public int getId() {
        return id;
    }

    /**
     * Sets the id.
     *
     * @param   id      The id.
     */
    public void setId(int id) {
        this.id = id;
    }
   
    public void addOperation(Operation op){
        getAllowedOperations().add(op);
    }
}



so that's all fine, and you'll see in the log that user is inserted and the user is inserted into the database, however I have another object called Project and one called ActivityRecord (which is like an audit record):

Project
Code:

@Entity
public class Project implements Serializable {       

    /**
     * The id.
     */
    @Id
    @GeneratedValue
    private Integer id;
   
    /**
     * The project name.
     */
    @Column(unique=true)
    private String name;
   
    /**
     * The project description.
     */
    @Column
    private String description;
   
    /**
     * The teams that have been assigned to work on this project.
     */     
    @OneToMany
    private Collection<Team> teams;
   
    /**
     * How often releases of this project are planned to be made.
     */
    @Embedded
    @AttributeOverrides( {
            @AttributeOverride(name="cycle", column = @Column(name="RELEASECYCLE") ),
            @AttributeOverride(name="type", column = @Column(name="RELEASECYCLETYPE") )
    } )
    private Frequency releaseCycle;
   
    /**
     * The expected life of the deliverables.
     */
    @Embedded
    @AttributeOverrides( {
            @AttributeOverride(name="cycle", column = @Column(name="LIFECYCLE") ),
            @AttributeOverride(name="type", column = @Column(name="LIFECYCLETYPE") )
    } )   
    private Frequency deliverableExpectedLife;
   
    /**
     * The payback reporting cycle.
     */
    @Embedded
    @AttributeOverrides( {
            @AttributeOverride(name="cycle", column = @Column(name="PAYBACKCYCLE") ),
            @AttributeOverride(name="type", column = @Column(name="PAYBACKCYCLETYPE") )
    } )   
    private Frequency paybackReportingCycle;
   
    /**
     * The stakeholders.
     */
    @OneToMany
    private Collection<User> stakeholders = new ArrayList<User>();               
   
    /**
     * Creates a new project with no name or description.
     */
    public Project() {
    }
   
    /**
     * Creates a new project with a given name and description.
     *
     * @param name The project name.
     * @param description The project description.
     */
    public Project(String name, String description){
        this.name = name;
        this.description = description;
    }
   
    /**
     * Creates a new project with a given name and description.
     *
     * @param   name            The project name.
     * @param   description     The project description.
     * @param   releaseCycle    The anticipated release cycle.
     * @param   expectedLife    The expected life.
     * @param   payback         The payback.
     */
    public Project(String name, String description, Frequency releaseCycle, Frequency expectedLife, Frequency payback){
        this(name, description);
        this.releaseCycle = releaseCycle;
        this.deliverableExpectedLife = expectedLife;
        this.paybackReportingCycle = payback;
    }

    /**
     * Gets the project id.
     *
     * @return The id.
     */
    public int getId() {
        return id;
    }

    /**
     * Sets the project id.
     *
     * @param   id      Ths new id.
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * Gets the name for this project.
     *
     * @return The project name.
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the name for this project.
     *
     * @param   name    The project name.
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Gets the project description.
     *
     * @return The project description.
     */
    public String getDescription() {
        return description;
    }

    /**
     * Sets the project description.
     *
     * @param   description     The project description.
     */
    public void setDescription(String description) {
        this.description = description;
    }
   
    /**
     * Gets the teams assigned to this project.
     *
     * @return The teams assigned to this project.
     */
    public Collection<Team> getTeams() {
        return teams;
    }

    /**
     * Sets the teams assigned to this project.
     * @param teams The teams assigned to this project.
     */
    public void setTeams(Collection<Team> teams) {
        this.teams = teams;
    }   
   
    /**
     * Gets the release cycle.
     *
     * @return  The release cycle.
     */
    public Frequency getReleaseCycle() {
        return releaseCycle;
    }

    /**
     * Sets the release cycle.
     *
     * @param   releaseCycle        The relese cycle.
     */
    public void setReleaseCycle(Frequency releaseCycle) {
        this.releaseCycle = releaseCycle;
    }

    /**
     * Gets the expected life.
     *
     * @return  The expected life.
     */
    public Frequency getDeliverableExpectedLife() {
        return deliverableExpectedLife;
    }

    /**
     * Sets the expected life.
     *
     * @param   deliverableExpectedLife     The expected life.
     */
    public void setDeliverableExpectedLife(Frequency deliverableExpectedLife) {
        this.deliverableExpectedLife = deliverableExpectedLife;
    }

    /**
     * Gets the reporting cycle.
     *
     * @return  The reporting frequency.
     */
    public Frequency getPaybackReportingCycle() {
        return paybackReportingCycle;
    }

    /**
     * Sets the reporting cycle.
     *
     * @param   paybackReportingCycle       The reporting cycle.
     */
    public void setPaybackReportingCycle(Frequency paybackReportingCycle) {
        this.paybackReportingCycle = paybackReportingCycle;
    }

    /**
     * Gets the stakeholders.
     *
     * @return  The project stakeholders.
     */
    public Collection<User> getStakeholders() {
        return stakeholders;
    }

    /**
     * Sets the stakeholders.
     *
     * @param   stakeholders    The stakeholders.
     */
    public void setStakeholders(Collection<User> stakeholders) {
        this.stakeholders = stakeholders;
    }   
   
    /**
     * Checks to see if a user has been assigned to a project.
     *
     * @param   user    The user.
     * @return True if the user is assigned to this project, false otherwise.
     */
    public boolean isAssignedTo(User user){
        for(Team team : teams){
            if(team.hasMember(user)) return true;
        }
        return false;
    }
   
    /**
     * Standard toString() implementation.
     *
     * @return A string representation of this object.
     */
    @Override
    public String toString() {
        return lookupToString("Project") + lookupToString("Spacer") + getName();
    }       
   
    /**
     * Equals method implementation.
     *
     * @param   obj     The object to test equality against.
     * @return true if the two objects are equal, false otherwise.
     */
    @Override   
    public boolean equals(Object obj){
        try{
            if(id == null)
                return new EqualsBuilder()
                    .reflectionEquals(obj, this);
            else return id == ((Project)obj).getId();
        }catch(ClassCastException e){
            return false;
        }
    }
   
    /**
     * Hashcode method implementation.
     *
     * @return The hashcode for this object.
     */
    public int hashCode(){
        return new HashCodeBuilder().reflectionHashCode(this);
    }
}



ActivityRecord
Code:

@Entity
public class ActivityRecord implements Serializable {
   
    /**
     * The record id.
     */
    @Id
    @GeneratedValue
    private int id;
   
    /**
     * The date that the record was created.
     */
    @Column
    @Temporal(TemporalType.TIMESTAMP)
    private Date created;
   
    /**
     * The operation that was executed.
     */
    @Column
    @Enumerated
    private Operation operation;
   
    /**
     * The project that this operation was executed on.
     */
    @ManyToOne(optional=true)
    private Project project;
   
    /**
     * The user that executed the command.
     */
    @ManyToOne
    private User executedBy;
   
    /**
     * String representation of the affected targets.
     */
    @CollectionOfElements
    private Collection<String> affectedTargets;
   
    /**
     * Creates a new ActivityRecord.
     */
    public ActivityRecord(){}
   
    /**
     * Creates a new instance of ActivityRecord.
     *
     * @param   operation       The operation.
     * @param   executedBy      The user executing the operation.
     * @param   affectedObjects The objects that are affected by this action.
     */
    public ActivityRecord(Operation operation, User executedBy, Object[] affectedObjects) {
        affectedTargets = new ArrayList<String>();
        for(Object tmp : affectedObjects){
            affectedTargets.add(tmp.toString());
        }
        this.created = new Date();
        this.executedBy = executedBy;
        this.operation = operation;       
    }
   
    /**
     * Creates a new instance of ActivityRecord.
     *
     * @param   operation       The operation.
     * @param   executedBy      The user that executed this operation.
     * @param   project         The project this command is acting upon.
     * @param   affectedObjects The objects that are affected by this command.
     */
    public ActivityRecord(Operation operation, User executedBy, Project project, Object[] affectedObjects){
        this(operation, executedBy, affectedObjects);
        setProject(project);
    }
   
    /**
     * Standard toString() implementation.
     *
     * @return A string representation of this object.
     */
    @Override
    public String toString() {
        return lookupToString("ActivityRecord");
    }
   
    /**
     * Equals method implementation.
     *
     * @param   obj     The object to test equality against.
     * @return true if the two objects are equal, false otherwise.
     */
    @Override
    public boolean equals(Object obj){
        try{
            return new EqualsBuilder()
            .reflectionEquals(obj, this);
        }catch(ClassCastException e){
            return false;
        }
    }
   
    /**
     * Hashcode method implementation.
     *
     * @return The hashcode for this object.
     */
    public int hashCode(){
        return new HashCodeBuilder().reflectionHashCode(this);
    }

    /**
     * Gets the id.
     *
     * @return  id      The Id.
     */
    public int getId() {
        return id;
    }

    /**
     * Sets the id.
     *
     * @param   id      The id.
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * Gets the date this record was created.
     *
     * @return  The date this record was created.
     */
    public Date getCreated() {
        return created;
    }

    /**
     * Sets the date this record was created.
     *
     * @param   created     The date this record was created.
     */
    public void setCreated(Date created) {
        this.created = created;
    }

    /**
     * Gets the operation for this record.
     *
     * @return  The operation.
     */
    public Operation getOperation() {
        return operation;
    }

    /**
     * Sets the operation for this record.
     *
     * @param   operation       The operation.
     */
    public void setOperation(Operation operation) {
        this.operation = operation;
    }

    /**
     * Gets the project that this operation was executed on.
     *
     * @return  The project, or null if the operation is not run at the project level.
     */
    public Project getProject() {
        return project;
    }

    /**
     * Sets the project that this operation was executed on.
     *
     * @param   project     The project.
     */
    public void setProject(Project project) {
        this.project = project;
    }

    /**
     * Gets the user that executed this operation.
     *
     * @return  The user.
     */
    public User getExecutedBy() {
        return executedBy;
    }

    /**
     * Sets the user that executed this operation.
     *
     * @param   executedBy      The user that executed the operation.
     */
    public void setExecutedBy(User executedBy) {
        this.executedBy = executedBy;
    }

    /**
     * Gets string representations of the affected targets.
     *
     * @return  The string representation of the affected objects.
     */
    public Collection<String> getAffectedTargets() {
        return affectedTargets;
    }

    /**
     * Sets the affected targets.
     *
     * @param   affectedTargets     The affected targets string representations.
     */
    public void setAffectedTargets(Collection<String> affectedTargets) {
        this.affectedTargets = affectedTargets;
    }
   
}





The embedded Frequency object is:
Code:

@Embeddable
public class Frequency implements Serializable{
   
    /**
     * The logger.
     */
    private static final Logger log = Logger.getLogger(Frequency.class);
   
    /**
     * The cycle number.
     */   
    @Column
    private int cycle;
   
    /**
     * The frequency type.
     */
    @Enumerated
    private FrequencyType type;
   
    /**
     * Creates a new instance of Frequency
     */
    public Frequency() {
    }
   
    /**
     * Creates a new instance of Frequency.
     *
     * @param   cycle       The frequency cycle.
     * @param   type        The frequency type.
     */
    public Frequency(int cycle, FrequencyType type){
        this.cycle = cycle;
        this.type = type;
    }
   
    /**
     * Standard toString() implementation.
     *
     * @return A string representation of this object.
     */
    @Override
    public String toString() {
        return lookupToString("Frequency") + lookupToString("Spacer") + getCycle() + " " + getType();
    }
   
    /**
     * Equals method implementation.
     *
     * @param   obj     The object to test equality against.
     * @return true if the two objects are equal, false otherwise.
     */
    @Override
    public boolean equals(Object obj){
        try{
            return new EqualsBuilder()
            .reflectionEquals(obj, this);
        }catch(ClassCastException e){
            return false;
        }
    }
   
    /**
     * Hashcode method implementation.
     *
     * @return The hashcode for this object.
     */
    public int hashCode(){
        return new HashCodeBuilder().reflectionHashCode(this);
    }

    /**
     * Gets the cycle for this frequency.
     *
     * @return  The cycle.
     */
    public int getCycle() {
        return cycle;
    }

    /**
     * Sets the cycle for this frequency.
     *
     * @param   cycle       The cycle.
     */
    public void setCycle(int cycle) {
        this.cycle = cycle;
    }

    /**
     * Gets the frequency type.
     *
     * @return  The frequency type.
     */
    public FrequencyType getType() {
        return type;
    }

    /**
     * Sets the frequency type.
     *
     * @param   type        The frequency type.
     */
    public void setType(FrequencyType type) {
        this.type = type;
    }
   
}





The code that inserts these objects is as follows (with EntityManagerFactory and UserTransaction set using the @PersistenceUnit and @Resource annotations, which all works fine -- ie, they aren't null when executing):

Top level code:
Code:

        try{           
            transaction.begin();
            for(FullyFundedCommand command : commands){
                current = command;
                command.setEntityManager(manager);
                command.execute(user);
            }
            transaction.commit();
        }catch(Exception e){
            logFailedCommand(current, e);
            try{
                transaction.rollback();
            }catch(SystemException exc){
                log.fatal("Error rolling back transaction, please check data integrity.", exc);               
            }
            throw e;
        }




The code in command.execute(user) is:

Code:

    public void execute(User executedBy) throws Exception{
        assertAuthorized(executedBy, getOperation());       
        execute();
        ActivityRecord record;
        if(getTargetProject() == null) record = new ActivityRecord(getOperation(), executedBy, getOperationTargets());
        else record = new ActivityRecord(getOperation(), executedBy, getTargetProject(), getOperationTargets());
        manager.persist(record);       
    }




And the implementation of the execute() method is:

Code:

    public void execute() throws Exception {
        getEntityManager().persist(theProject);
    }




So basically just storing a project! I can step through all the code and it exits the method fine...no exceptions, but also the project isn't stored!?!

Here is the log for the call:

Code:

163891 [httpWorkerThread-8080-0] INFO  org.directwebremoting.impl.DefaultRemoter  - Exec: JProjectController.newProject()
163891 [httpWorkerThread-8080-0] DEBUG org.directwebremoting.impl.DefaultRemoter  - --Object created,  stored in session. id=2388_1151958557843
163937 [httpWorkerThread-8080-0] DEBUG org.hibernate.impl.SessionImpl  - opened session at timestamp: 4718422253756416
163937 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163937 [httpWorkerThread-8080-0] DEBUG org.hibernate.ejb.AbstractEntityManagerImpl  - Looking for a JTA transaction to join
163937 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163937 [httpWorkerThread-8080-0] DEBUG org.hibernate.ejb.AbstractEntityManagerImpl  - No JTA transaction found
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.DefaultInitializeCollectionEventListener  - initializing collection [com.curiousllama.fullyfunded.model.User.allowedOperations#1]
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.DefaultInitializeCollectionEventListener  - checking second-level cache
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.DefaultInitializeCollectionEventListener  - collection not cached
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.loader.Loader  - loading collection: [com.curiousllama.fullyfunded.model.User.allowedOperations#1]
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.ConnectionManager  - opening JDBC connection
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.SQL  - select allowedope0_.FFUser_id as FFUser1_0_, allowedope0_.element as element0_ from FFUser_allowedOperations allowedope0_ where allowedope0_.FFUser_id=?
163953 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - preparing statement
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.type.IntegerType  - binding '1' to parameter: 1
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to open ResultSet (open ResultSets: 0, globally: 0)
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.loader.Loader  - result set contains (possibly empty) collection: [com.curiousllama.fullyfunded.model.User.allowedOperations#1]
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.CollectionLoadContext  - uninitialized collection: initializing
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.loader.Loader  - processing result set
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.loader.Loader  - result set row: 0
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.loader.Loader  - result row:
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.type.IntegerType  - returning '1' as column: FFUser1_0_
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.loader.Loader  - found row of collection: [com.curiousllama.fullyfunded.model.User.allowedOperations#1]
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.CollectionLoadContext  - reading row
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.type.EnumType  - Returning '0' as column element0_
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.loader.Loader  - done processing result set (1 rows)
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to close ResultSet (open ResultSets: 1, globally: 1)
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - closing statement
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.ConnectionManager  - aggressively releasing JDBC connection
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.ConnectionManager  - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.CollectionLoadContext  - 1 collections were found in result set for role: com.curiousllama.fullyfunded.model.User.allowedOperations
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.CollectionLoadContext  - collection fully initialized: [com.curiousllama.fullyfunded.model.User.allowedOperations#1]
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.CollectionLoadContext  - 1 collections initialized for role: com.curiousllama.fullyfunded.model.User.allowedOperations
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.StatefulPersistenceContext  - initializing non-lazy collections
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.loader.Loader  - done loading collection
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.DefaultInitializeCollectionEventListener  - collection initialized
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - transient instance of: com.curiousllama.fullyfunded.model.Project
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.DefaultPersistEventListener  - saving transient instance
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.transaction.Isolater  - surrounding JTA transaction suspended [J2EETransaction: txId=5 nonXAResource=3 jtsTx=null localTxStatus=0 syncs=[com.sun.enterprise.resource.PoolManagerImpl$SynchronizationListener@52438]]
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - opening JDBC connection
163969 [httpWorkerThread-8080-0] DEBUG org.hibernate.SQL  - select next_hi from hibernate_unique_key for read only with rs
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.SQL  - update hibernate_unique_key set next_hi = ? where next_hi = ?
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.transaction.Isolater  - surrounding JTA transaction resumed [J2EETransaction: txId=5 nonXAResource=3 jtsTx=null localTxStatus=0 syncs=[com.sun.enterprise.resource.PoolManagerImpl$SynchronizationListener@52438]]
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.id.TableHiLoGenerator  - new hi value: 1
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - generated identifier: 32768, using strategy: org.hibernate.id.TableHiLoGenerator
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - saving [com.curiousllama.fullyfunded.model.Project#32768]
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.WrapVisitor  - Wrapped collection in role: com.curiousllama.fullyfunded.model.Project.stakeholders
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.IdentifierValue  - id unsaved-value: 0
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - transient instance of: com.curiousllama.fullyfunded.model.ActivityRecord
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.DefaultPersistEventListener  - saving transient instance
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.transaction.Isolater  - surrounding JTA transaction suspended [J2EETransaction: txId=5 nonXAResource=3 jtsTx=null localTxStatus=0 syncs=[com.sun.enterprise.resource.PoolManagerImpl$SynchronizationListener@52438]]
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - opening JDBC connection
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.SQL  - select next_hi from hibernate_unique_key for read only with rs
163984 [httpWorkerThread-8080-0] DEBUG org.hibernate.SQL  - update hibernate_unique_key set next_hi = ? where next_hi = ?
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.AbstractBatcher  - closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.transaction.Isolater  - surrounding JTA transaction resumed [J2EETransaction: txId=5 nonXAResource=3 jtsTx=null localTxStatus=0 syncs=[com.sun.enterprise.resource.PoolManagerImpl$SynchronizationListener@52438]]
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.id.TableHiLoGenerator  - new hi value: 2
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - generated identifier: 65536, using strategy: org.hibernate.id.TableHiLoGenerator
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - saving [com.curiousllama.fullyfunded.model.ActivityRecord#65536]
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.event.def.WrapVisitor  - Wrapped collection in role: com.curiousllama.fullyfunded.model.ActivityRecord.affectedTargets
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.engine.IdentifierValue  - id unsaved-value: null
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG org.hibernate.jdbc.JDBCContext  - TransactionFactory reported no active transaction; Synchronization not registered
164000 [httpWorkerThread-8080-0] DEBUG com.curiousllama.fullyfunded.controls.ProjectController  - new project successfully created.




This is driving me insane, can anyone see where I've gone wrong here?

Cheers
Adam[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 2:50 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Quote:
This is driving me insane, can anyone see where I've gone wrong here?


Sure - http://wiki.jboss.org/wiki/Wiki.jsp?page=BadPostBig.

Why are you using BMT?

Did you try to debug, to see if PersistEventListener gets called? And your insert statement is added to batcher?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 6:03 am 
Newbie

Joined: Mon Jul 03, 2006 4:28 pm
Posts: 15
Point taken on the long post....since there was no error message or exception being thrown I thought I'd err on the side of caution and supply the level of information that I would expect and need to solve the problem, I apologise if that was too much.

In regards to BMT, I was under the impression that when using javax.persistence packages (i.e. ejb3) from the web tier you had to rely on user managed transactions, and that container managed transactions were only available from within pojos annotated as session beans, please correct me if I'm wrong here. Attempting to persist using the entity manager without a transaction fires a javax.persistence.TransactionRequiredException. If there is a way to configure the jee5 persistence unit to allow container managed transactions from the web tier please let me know, I would really appreciate it.

With reference to debugging and "Did you try to debug, to see if PersistEventListener gets called? And your insert statement is added to batcher?" I was kind of hoping I could leave downloading the hibernate source and mounting it for debug as a last resort operation, you can appreciate that delving into the source of an open source program is an expensive operation and one that should be pursued as a last option.

You sound like you have a lot of experience to offer on this subject, I'd really be interested in anything you have to offer in regards to my problem.

Cheers
Adam


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 7:16 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
For persisting pojos, let your session bean do that - with container managed persistence.

Problem with using CMT + web tier might be in lazy loading of assiciations - use Seam to help you :-).
Or you can probably start UserTransaction still on web tier before invoking session bean.
Or you can load all that you need - all lazy associations and properties.

Yep, I agree about debuging - it can be costly.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 3:56 pm 
Newbie

Joined: Mon Jul 03, 2006 4:28 pm
Posts: 15
great suggestions, thanks for the input. Unfortunately I'm limited by non functional requirements that eliminate the possiblity of using seam or session beans.


however, with some experimentation I believe I've found the problem so I'll post it incase anyone else comes across it.

You have to create your EntityManager within the transaction, or it will not commit to the database....so:

given:

Code:
@PersistenceUnit
private EntityManagerFactory emf;

@Resource
private UserTransaction txn;


Case 1:
Code:
txn.begin();
EntityManager manager = emf.createEntityManager();
manager.persist(myObject);
txn.commit();


Will work fine and will persist your entity, however:

Case 2:
Code:
EntityManager manager = emf.createEntityManager();
txn.begin();
manager.persist(myObject);
txn.commit();

Will fail silently with no error messages.

Hope this helps anyone else that hits the same problem.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 07, 2006 9:21 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
if you create the EM in BMT you must call em.joinTransaction() to let it register to the transaction

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.