I have a problem with the "long-lived" transaction in my ejb3 project, which built in JBossAS4.0.4RC1 with install-component "all".
I found the file "persistence.properties" under "ejb3.deployer\META-INF" is configurated by default like this:
hibernate.transaction.flush_before_completion=true
I think it supports not the "long-lived" transaction, because if i change this "flush_before_completion" value to "false", it runs without problem with
"PersistenceContextType.EXTENDED " (@PersistenceContext(unitName="...",type=PersistenceContextType.EXTENDED)) My problem is, in my "old" ejb3 project under JBossAS4.0.3SP1, i try to load the "lazy fetch" Object in EntityBeans with the function like this:
@ManyToOne(cascade={}, fetch=FetchType.LAZY)
@JoinColumn(name="mandant_id", unique=false, nullable=true, insertable=true, updatable=true)
public InfondsMandant getMandant() {
Hibernate.initialize(this.mandant);
return this.mandant;
}
and by default i dont need to configurate the file "persistence.properites" to support the "long-lived" transaction.
But now if i want to load the "lazy fetch" Object with the function "Hibernate.initialize()" under the configuration "flush_before_completion=false(long-lived support)", it throws the exception "org.hibernate.LazyInitializationException: could not initialize proxy - no Session".
And if i set the value of "flush_before_completion" back to "true", the function "Hibernate.initialize(lazy)" runs but fine.
So now i dont know what problem is it and i cannt use the "long-lived transaction" and Hibernate.initialize(lazy) together.
Someone knows that, how should i do, so that JBoss supports them both?
thanks alot for your helpers!