Sorry I had the list in digest mode...
"
I have re-generated all scaffold code. With the stock Beta5 code this is
the root exception, happening when I click on "Create New":
Caused by: javax.el.PropertyNotFoundException:
/scaffold/address/search.xhtml @34,85 value="#{addressBean.search.line1}":
Target Unreachable, 'search' returned null
at
com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIInput.validate(UIInput.java:960)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIInput.executeValidate(UIInput.java:1233)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIInput.processValidators(UIInput.java:698)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIForm.processValidators(UIForm.java:253)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1172)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
... 27 more
22:28:44,918 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cpox].[Faces
Servlet]] (http--127.0.0.1-8080-1) Servlet.service() for servlet Faces
Servlet
threw exception: java.lang.IllegalStateException: Context is already active
at
org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:311)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:114)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:88)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126)
[prettyfaces-jsf2-3.3.2.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:543)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:528)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:454)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:398)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_29]
Then I have set EntityManager* classes as here
https://github.com/42Lines/blog-cdidemo/tree/master/src/main/java/net/ftl...
replaced @PersistenceContext(type = PersistenceContextType.EXTENDED)
to
@Inject, then the exception is this, but
Caused by: java.lang.NullPointerException
at
org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:72)
[hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
at
org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:114)
[hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
at
org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149)
[hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
at
org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1200)
[hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at
org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:171)
[hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at
org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:90)
[hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at
org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:111)
[hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at
org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:106)
[hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[:1.6.0_29]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[:1.6.0_29]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_29]
at
org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:48)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.proxies.EntityManagerFactory$-1828776958$Proxy$_$$_WeldClientProxy.createEntityManager(EntityManagerFactory$-1828776958$Proxy$_$$_WeldClientProxy.java)
[weld-cor
e-1.1.2.Final.jar:]
at
com.cpox.utils.EntityManagerProducer.create(EntityManagerProducer.java:17)
[classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[:1.6.0_29]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[:1.6.0_29]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_29]
at
org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:169)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.ProducerMethod$1.produce(ProducerMethod.java:149)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:361)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:122)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:124)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.proxies.EntityManager$-10488411$Proxy$_$$_WeldClientProxy.getCriteriaBuilder(EntityManager$-10488411$Proxy$_$$_WeldClientProxy.java)
[weld-core-1.1.2.Final.jar:]
at com.cpox.view.AddressBean.paginate(AddressBean.java:156) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[:1.6.0_29]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[:1.6.0_29]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_29]
at
org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:370)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:122)
[jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:130)
[jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:45)
[jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor.processInvocation(StatefulSessionSynchronizationInterceptor.java:132)
[jboss-as-ejb3-7.0.2.Final.
jar:7.0.2.Final]
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ee.component.ViewDescription$ComponentDispatcherInterceptor.processInvocation(ViewDescription.java:202)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.jpa.interceptor.SFSBInvocationInterceptor.processInvocation(SFSBInvocationInterceptor.java:58)
[jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ejb3.component.stateful.StatefulComponentInstanceInterceptor.processInvocation(StatefulComponentInstanceInterceptor.java:61)
[jboss-as-ejb3-7.0.2.Final.jar:7.0.2.F
inal]
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor$CustomSessionInvocationContext.proceed(SessionInvocationContextInterceptor.java:126)
[jboss-as-ejb3-7.0.
2.Final.jar:7.0.2.Final]
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:194)
[jboss-as-ejb3-7.0.2.Final.jar:7.0.2.Final]
... 74 more
Probably my setup is not properly done?
Anyway, here is the entity class and the generated scaffold code (it is not
mission critical, I don't really use scaffold at the moment):
@Entity
@Audited
public class Address implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@Version
private Integer version;
@Column
@Length(max = 50)
private String line1;
@Column
@Length(max = 50)
private String line2;
@Column
@Length(max = 50)
private String line3;
@Column
@Length(max = 50)
private String line4;
@Column
@Length(max = 50)
private String line5;
public Long getId() {
return id;
}
public void setId(final Long id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public String getLine1() {
return line1;
}
public void setLine1(final String line1) {
this.line1 = line1;
}
public String getLine2() {
return line2;
}
public void setLine2(final String line2) {
this.line2 = line2;
}
public String getLine3() {
return line3;
}
public void setLine3(final String line3) {
this.line3 = line3;
}
public String getLine4() {
return line4;
}
public void setLine4(final String line4) {
this.line4 = line4;
}
public String getLine5() {
return line5;
}
public void setLine5(final String line5) {
this.line5 = line5;
}
}
@Named
@Stateful
@ConversationScoped
public class AddressBean implements Serializable {
private static final long serialVersionUID = 1L;
/*
* Support creating and retrieving Address entities
*/
private Long id;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
private Address address;
public Address getAddress() {
return this.address;
}
@Inject
private Conversation conversation;
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager entityManager;
public String create() {
this.conversation.begin();
return "create?faces-redirect=true";
}
public void retrieve() {
if (FacesContext.getCurrentInstance().isPostback()) {
return;
}
if (this.conversation.isTransient()) {
this.conversation.begin();
}
if (this.id == null) {
this.address = this.search;
} else {
this.address = this.entityManager.find(Address.class, getId());
}
}
/*
* Support updating and deleting Address entities
*/
public String update() {
this.conversation.end();
if (this.id == null) {
this.entityManager.persist(this.address);
return "search?faces-redirect=true";
} else {
this.entityManager.merge(this.address);
return "view?faces-redirect=true&id=" + this.address.getId();
}
}
public String delete() {
this.conversation.end();
this.entityManager.remove(this.entityManager.find(Address.class,
getId()));
return "search?faces-redirect=true";
}
public String cancel() {
this.conversation.end();
return "search?faces-redirect=true";
}
/*
* Support searching Address entities with pagination
*/
private int page;
private long count;
private List<Address> pageItems;
private Address search = new Address();
public int getPage() {
return this.page;
}
public void setPage(int page) {
this.page = page;
}
public int getPageSize() {
return 10;
}
public Address getSearch() {
return this.search;
}
public void setSearch(Address search) {
this.search = search;
}
public void search() {
this.page = 0;
}
public void paginate() {
CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
// Populate this.count
CriteriaQuery<Long> countCriteria = builder.createQuery(Long.class);
Root<Address> root = countCriteria.from(Address.class);
countCriteria = countCriteria.select(builder.count(root)).where(
getSearchPredicates(root));
this.count = this.entityManager.createQuery(countCriteria)
.getSingleResult();
// Populate this.pageItems
CriteriaQuery<Address> criteria =
builder.createQuery(Address.class);
root = criteria.from(Address.class);
TypedQuery<Address> query = this.entityManager.createQuery(criteria
.select(root).where(getSearchPredicates(root)));
query.setFirstResult(this.page * getPageSize()).setMaxResults(
getPageSize());
this.pageItems = query.getResultList();
}
private Predicate[] getSearchPredicates(Root<Address> root) {
CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
List<Predicate> predicatesList = new ArrayList<Predicate>();
String line1 = this.search.getLine1();
if (line1 != null && !"".equals(line1)) {
predicatesList.add(builder.like(root.<String>get("line1"),
'%'
+ line1 + '%'));
}
String line2 = this.search.getLine2();
if (line2 != null && !"".equals(line2)) {
predicatesList.add(builder.like(root.<String>get("line2"),
'%'
+ line2 + '%'));
}
String line3 = this.search.getLine3();
if (line3 != null && !"".equals(line3)) {
predicatesList.add(builder.like(root.<String>get("line3"),
'%'
+ line3 + '%'));
}
String line4 = this.search.getLine4();
if (line4 != null && !"".equals(line4)) {
predicatesList.add(builder.like(root.<String>get("line4"),
'%'
+ line4 + '%'));
}
String line5 = this.search.getLine5();
if (line5 != null && !"".equals(line5)) {
predicatesList.add(builder.like(root.<String>get("line5"),
'%'
+ line5 + '%'));
}
return predicatesList.toArray(new Predicate[predicatesList.size()]);
}
public List<Address> getPageItems() {
return this.pageItems;
}
public long getCount() {
return this.count;
}
/*
* Support listing and POSTing back Address entities (e.g. from inside
an
* HtmlSelectOneMenu)
*/
public List<Address> getAll() {
CriteriaQuery<Address> criteria = this.entityManager
.getCriteriaBuilder().createQuery(Address.class);
return this.entityManager.createQuery(
criteria.select(criteria.from(Address.class))).getResultList();
}
public Converter getConverter() {
return new Converter() {
@Override
public Object getAsObject(FacesContext context,
UIComponent component, String value) {
return AddressBean.this.entityManager.find(Address.class,
Long.valueOf(value));
}
@Override
public String getAsString(FacesContext context,
UIComponent component, Object value) {
if (value == null) {
return "";
}
return String.valueOf(((Address) value).getId());
}
};
}
}
On 3 January 2012 21:29, <forge-users-request(a)lists.jboss.org> wrote:
\
1. Re: Scaffold doesn't work with Seam? (Lincoln Baxter, III)
----------------------------------------------------------------------
Message: 1
Date: Tue, 3 Jan 2012 15:29:22 -0500
From: "Lincoln Baxter, III" <lincolnbaxter(a)gmail.com>
Subject: Re: [forge-users] Scaffold doesn't work with Seam?
To: forge-users List <forge-users(a)lists.jboss.org>
Message-ID:
<CAEp_U4GCD5WJpLzeRYE+4E+L7ZZsuBwd45ySH3zdtGZKeSBweQ(a)mail.gmail.com
>
Content-Type: text/plain; charset="iso-8859-1"
Do you have an EntityManagerProducer set up for Seam Persistence? It's
possible that Seam Persistence is starting a transaction too early, or that
something strange is going on. Any chance you could send the app (attached
sources) so I can take a look?
If so, you could try replacing the @EntityManager(type=EXTENDED) annotation
with @Inject in your AddressBean.
Does that work?
Thanks!
~Lincoln
On Tue, Jan 3, 2012 at 1:52 PM, Gabor Nagy <nagyga1(a)gmail.com> wrote:
> Hi All,
>
> Is that normal that I get this on any scaffold generated code if I have
> seam dependencies on the project?
> Should I report this?
>
> Bests,
> Gabor Nagy
>
> Caused by: javax.ejb.EJBException: Found extended persistence context in
> SFSB invocation call stack but that cannot be used because the
transaction
> already has a transactional cont
> ext associated with it. This can be avoided by changing application
code,
> either eliminate the extended persistence context or the transactional
> context. See JPA spec 2.0 section
> 7.6.3.1. Scoped persistence unit name=cpox.war#forge-default,
> persistence context already in transaction =ExtendedEntityManager
> [cpox.war#forge-default], extended persistence con
> text =ExtendedEntityManager [cpox.war#forge-default], extended
persistence
> context underlying entity manager
> =org.hibernate.ejb.EntityManagerImpl@199719b
> at org.jboss.as.jpa.container.
> ExtendedEntityManager.getEntityManager(ExtendedEntityManager.java:88)
> [jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
> at