Java代碼
public void save(TUser user){
session = sessionFactory
session
session
}
……
}
public class ClassB{
public void save (Order order){
session = sessionFactory
session
session
}
……
}
public class ClassC{
public void save(){
……
UserTransaction tx = new InitialContext()
classA
classB
tx
……
}
}
public class ClassA{
public void save(TUser user){
session = sessionFactory
session
session
}
……
}
public class ClassB{
public void save (Order order){
session = sessionFactory
session
session
}
……
}
public class ClassC{
public void save(){
……
UserTransaction tx = new InitialContext()
classA
classB
tx
……
}
}
上面代碼中的ClassC
Java代碼
public class ClassC{
public void save(){
……
session = sessionFactory
Transaction tx = session
classA
classB
tx
……
}
}
public class ClassC{
public void save(){
……
session = sessionFactory
Transaction tx = session
classA
classB
tx
……
}
}
[
From:http://tw.wingwit.com/Article/program/Java/ky/201311/29040.html