简体   繁体   English

JBoss AS 7.1.1和交易

[英]JBoss AS 7.1.1 and transactions

I have created a demo project on github where I can try J2EE 6 features (the application has been create with the tomee archetype, but I have changed lots of things then). 我已经在github上创建了一个演示项目,可以其中试用J2EE 6功能(该应用程序已使用tomee原型创建,但随后发生了很多变化)。

When I launch the application with the tomee maven plugin I can see application stores items and I can view them if I ask to list. 当我使用tomee maven插件启动应用程序时,我可以看到应用程序存储的项目,如果我要求列出,我可以查看它们。 When I launch the application with the jboss-as maven plugin I can see insert SQL, but when I do a select ... no data is returned: 当我使用jboss-as maven插件启动应用程序时,可以看到插入SQL,但是当我执行select ...没有数据返回:

12:50:07,530 INFO  [stdout] (http--127.0.0.1-8080-1) Hibernate: 
12:50:07,530 INFO  [stdout] (http--127.0.0.1-8080-1)     call next value for hibernate_sequence
12:50:07,574 INFO  [stdout] (http--127.0.0.1-8080-1) Hibernate: 
12:50:07,574 INFO  [stdout] (http--127.0.0.1-8080-1)     /* insert icteam.demojee.domain.Book
12:50:07,574 INFO  [stdout] (http--127.0.0.1-8080-1)         */ insert 
12:50:07,574 INFO  [stdout] (http--127.0.0.1-8080-1)         into
12:50:07,574 INFO  [stdout] (http--127.0.0.1-8080-1)             Book
12:50:07,574 INFO  [stdout] (http--127.0.0.1-8080-1)             (title, id) 
12:50:07,575 INFO  [stdout] (http--127.0.0.1-8080-1)         values
12:50:07,575 INFO  [stdout] (http--127.0.0.1-8080-1)             (?, ?)
12:50:08,546 INFO  [stdout] (http--127.0.0.1-8080-1) Hibernate: 
12:50:08,547 INFO  [stdout] (http--127.0.0.1-8080-1)     /* select
12:50:08,547 INFO  [stdout] (http--127.0.0.1-8080-1)         generatedAlias0 
12:50:08,547 INFO  [stdout] (http--127.0.0.1-8080-1)     from
12:50:08,547 INFO  [stdout] (http--127.0.0.1-8080-1)         Book as generatedAlias0 */ select
12:50:08,547 INFO  [stdout] (http--127.0.0.1-8080-1)             book0_.id as id2_,
12:50:08,547 INFO  [stdout] (http--127.0.0.1-8080-1)             book0_.title as title2_ 
12:50:08,548 INFO  [stdout] (http--127.0.0.1-8080-1)         from
12:50:08,548 INFO  [stdout] (http--127.0.0.1-8080-1)             Book book0_

I think it's a problem with transaction but I'm not sure I've done all the things correctly. 我认为这是交易的问题,但我不确定我是否正确完成了所有事情。 What I have done is: 我所做的是:

  1. create a JTA datasource and deployed it on JBoss 创建一个JTA数据源并将其部署在JBoss上
  2. added transaction annotation (but I think they are not needed 'cause the bean is annotated as @Stateless ) 添加了事务注释 (但是我认为不需要它们,因为Bean被注释为@Stateless

Do you have any hint to give to me? 你有什么要给我的提示吗?

Thanks in advance 提前致谢

Bye 再见

I have solved adding on the JSF backed bean the annotation @Stateful . 我已经解决了在JSF支持的bean上添加注释@Stateful I have find that it can run using any of these solutions: 我发现它可以使用以下任何一种解决方案运行:

  1. annotate JSF backed bean with @Stateful and @Model @Stateful@Model注释JSF支持的bean
  2. annotate JSF backed bean with @Model and @SessionScoped 使用@Model@SessionScoped注释JSF支持的bean
  3. annotate JSF backed bean with @Stateless and @Dependent @Stateless@Dependent注释JSF支持的bean

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM