[jboss-user] [JBoss Seam] - Problem with manual flush mode for managed persistence conte

nickarls do-not-reply at jboss.com
Tue Jul 31 07:31:13 EDT 2007


Hi, I have a problem trying to delay my inserts using manual flush mode.

I have followed the manual as far as possible but hibernate still insists on inserting in the middle of the conversation (verified using conversation observers)

I have 

  | 	<persistence:managed-persistence-context name="entityManager"
  | 		auto-create="true"
  | 		persistence-unit-jndi-name="java:/conceptEntityManagerFactory" />
  | 
  | 
and

  | 	@PersistenceContext(type=EXTENDED)
  | 	private EntityManager entityManager;
  | 
and

  | 	@Begin(flushMode=MANUAL)
  | 	public String start() {
  | 		return "/concept.xhtml";
  | 	}
  | 
and

  | 	public String insert() {
  | 		FooEntity entity = new FooEntity();
  | 		entity.setData("foo");
  | 		entityManager.persist(entity);
  | 		return "/concept.xhtml";
  | 	}
  | 
and

  | 	@End
  | 	public String flush() {
  | 		entityManager.flush();
  | 		return "/concept.xhtml";
  | 	}
  | 
and

  | @Entity
  | @Name("fooEntity")
  | @Scope(SESSION)
  | @Table(name="footable")
  | public class FooEntity {
  | 	private Integer id;
  | 	private String data;
  | 	
  | 	@Id @GeneratedValue @Column(name="id_col")
  | 	public Integer getId() {
  | 		return id;
  | 	}
  | 
  | 	public void setId(Integer id) {
  | 		this.id = id;
  | 	}
  | 	
  | 	@Column(name="data_col") @NotNull @Length(min=5, max=15)
  | 	public String getData() {
  | 		return data;
  | 	}
  | 	
  | 	public void setData(String data) {
  | 		this.data = data;
  | 	}
  | }
  | 

Have I misunderstood something or shouldn't I see the inserts happening when the conversation ends (clicking the bound start-insert-flush buttons in that order)?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069115#4069115

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069115



More information about the jboss-user mailing list