[EJB 3.0] - Re: MappingException: Repeated column in mapping for entity
by lpmon
Felix,
So how is the EJB subsystem going to know which class to return if I don't use a discriminator column?
I tried removing the discriminator as you suggested, knowing it would not work, and as I thought it did not work. I get the error below with no discriminator column in any of the classes. I previously only declared the discriminator column on the base class and used @DescriminatorValue in the subclasses. That is how I cofigured when I started this thread/post.
Error returned:
Could not find a setter for property connected in class com.tester.server.FMPUnit
Partial stack trace:
16:04:56,352 WARN [ServiceController] Problem starting service persistence.units:ear=shockwatch.ear,jar=shockwatch.jar,unitName=shockwatch
javax.persistence.PersistenceException: org.hibernate.PropertyNotFoundException: Could not find a setter for property connected in class com.tester.server.FMPUnit
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:102)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy69.start(Unknown Source)
... MORE...
FYI: This is a different app so the class names don't match my original post.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120661#4120661
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120661
18 years, 5 months
[JBoss Seam] - seam don't do the initialization
by robert-trudel
hi
i use seam 1.2.1 and jboss 4.05
i have a mbeam who implements Schedulable and i would like to use a seam component
i do:
| TestService as = new TestService();
| Â try {
| Â test.calculate;
| } catch (Exception e) {
| Â e.printStackTrace();
| Â }
| }
|
my testservice class
| @Name("testService")
| @Scope(ScopeType.APPLICATION)
| public class TestService {
| Â public boolean calculate()throws Exception {
| Â TestComponent tc = TestComponent.getInstance();
| Â return tc.test();
| Â }
| }
|
my test component code
| @Name("testComponent")
| @Scope(ScopeType.CONVERSATION)
| public class TestComponent
| implements Serializable{
|
| @In (create=true)
| Â User user ;
|
| Â protected TestBean testBean ;
|
| Â public static TestComponent getInstance() {
| Â try {
| Â return
| (TestComponent)Component.getInstance(TestComponent.class,
| Â true);
| Â } catch (Exception e0) {
| Â throw new TechnicalException(e0);
| }
| }
| }
|
when i try to get an instance of TestComponent in TestService class, i debuged and i saw than seam don't find the lookup in the context (Contexts.lookupInStatefulContexts(name)) and i get No application context active . Seam don't do any initialization.
is there any solution?
thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120646#4120646
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120646
18 years, 5 months
[EJB 3.0] - Re: Transactions broken? Trivial Hibernate example with EJB3
by smithmb
Thank you for the reply -- setting relaxAutoCommit does not seem to work. Data is still committed immediately by the transaction manager, using the datasource I listed above PLUS relaxAutoCommit=true.
I even tried a very basic session bean method:
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void test()
| {
|
| try {
| javax.sql.DataSource ds = (javax.sql.DataSource) new InitialContext().lookup("java:/MySqlDS");
| java.sql.Connection conn = ds.getConnection();
|
| System.out.println("IS AUTOCOMMIT: " + (conn.getAutoCommit()));
|
| Statement statement = conn.createStatement();
| statement.execute("DELETE FROM BOOK");
| statement.execute("INSERT INTO BOOK(title,author) VALUES(\"Should not see this title\",\"Should not see this author\")");
|
|
| ctx.setRollbackOnly();
|
| statement.close();
| conn.close();
|
| } catch (Exception ex) {
| System.out.println(ex);
| }
| }
|
I *do* see the data that was inserted when it shouldn't have been. If, in that method above, I call conn.getAutoCommit(), it is set to false. I think the transaction manager is doing something wrong, but I have no way of investigating this further =/.
Please help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120644#4120644
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120644
18 years, 5 months
[EJB 3.0] - Re: Transactions broken? Trivial Hibernate example with EJB3
by smithmb
Thank you for the reply -- setting relaxAutoCommit does not seem to work. Data is still committed immediately by the transaction manager, using the datasource I listed above PLUS relaxAutoCommit=true.
I even tried a very basic session bean method:
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void test()
| {
|
| try {
| javax.sql.DataSource ds = (javax.sql.DataSource) new InitialContext().lookup("java:/MySqlDS");
| java.sql.Connection conn = ds.getConnection();
|
| System.out.println("IS AUTOCOMMIT: " + (conn.getAutoCommit()));
|
| Statement statement = conn.createStatement();
| statement.execute("DELETE FROM BOOK");
| statement.execute("INSERT INTO BOOK(title,author) VALUES(\"Should not see this title\",\"Should not see this author\")");
|
|
| ctx.setRollbackOnly();
|
| statement.close();
| conn.close();
|
| } catch (Exception ex) {
| System.out.println(ex);
| }
| }
|
I *do* see the data that was inserted when it shouldn't have been. If, in that method above, I call conn.getAutoCommit(), it is set to false. I think the transaction manager is doing something wrong, but I have no way of investigating this further =/.
Please help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120643#4120643
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120643
18 years, 5 months