[EJB/JBoss] - Problem with updating same row several times in one transact
by wonker
I am a relative newbie to JBoss so excuse my dumbness or the lack of technical info, but heres my best shot. I am using ejbs (generated via xdoclet) and JBoss 3.2.5.
In my facade methods, I can potentially update the same db row several times in one transaction i.e.
| for(Iterator it = updates.iterator()l; it.hasNext();) {
|
| // Get value object
| TestValue value = (TestValue) it.next();
|
| // Get local home instance
| TestLocalHome home = (TestLocalHome) homeFactory.getLocalHome(TEST_LOCAL_HOME);
|
| // Get local instance
| TestLocal local = home.findByPrimaryKey(value.getId());
|
| // Update local instance
| local.setCommissionFeeValue(value);
|
| // Print some debug
| System.err.println("Updating - " + local.getCommissionFeeValue());
| }
|
In sql terms it would be like -
| UPDATE TEST SET VALUE = 'A' WHERE ID = 1;
| UPDATE TEST SET VALUE = 'B' WHERE ID = 1;
| UPDATE TEST SET VALUE = 'C' WHERE ID = 1;
| UPDATE TEST SET VALUE = 'D' WHERE ID = 1;
| ...
|
Although for some reason, JBoss only issues an UPDATE sql command to the db, only after the last update (I know this through the logs as only then does the EJBQL command get dumped to the logs).
The reason this is a problem, is that I have a trigger on the table which after these updates writes into an audit table, recording all chanes to the row. So for the scernaio above I should see 4 audit rows, but I only see the 1 (corresponds to the last update).
Does anyone have ideas about if this is a coding issue or if JBoss is trying to be clever. Is there a way I can make it un-clever :)
Cheers,
Niraj
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966486#3966486
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966486
19 years, 8 months
[Persistence, JBoss/CMP, Hibernate, Database] - Persistence Manager Exception
by galo.navarro
JBoss 4.0.4 GA, EJB3 RC8
Testing EJB3, Stateless & Statefull examples work, my hypersonic database is configured and working, default datasource configured.
| java: Namespace
|
| +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
| +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
|
I'm trying to get an Entity EJB to write something to that datasource but I get the following error:
17:08:46,983 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=entity.ejb3
java.lang.RuntimeException: Field private javax.persistence.EntityManager org.jboss.tutorial.entity.bean.ShoppingCartBean.manager @PersistenceUnit in error: EMPTY STRING unitName but there is no deployments in scope
This is my entity bean:
Order.java
@Entity
| @Table(name = "PURCHASE_ORDER")
| public class Order implements java.io.Serializable {
|
| private static final long serialVersionUID = 1L;
| private int id;
| private double total;
| private Collection<LineItem> lineItems;
|
|
| public Order() {
| super();
| }
|
| @Id @GeneratedValue(strategy=GenerationType.AUTO)
| public int getId()
| {
| return id;
| }
|
I use it from a stateless bean that doesn't do much
| package slsb;
|
| import javax.ejb.Stateless;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import entity.*;
|
| import model.Item;
|
| @Stateless
| public class SimpleStatelessBean implements SimpleStatelessBeanRemote, SimpleStatelessBeanLocal {
|
| @PersistenceContext()
| private EntityManager em;
|
| public Item getItem(Long id) {
| Order o = new Order();
| o.setId(10);
| o.setLineItems(null);
| o.setTotal(100);
| em.persist(o);
| Item item = new Item();
| item.setId(id);
| item.setName("A Java mug");
| return item;
| }
| }
|
I thought it might be due to a missing persistence.xml file but the error is still the same, this is my persistence.xml, but anyway I didn't think you actually needed this (i've seen examples from the Jboss labs working without them, is it really needed?)
<persistence>
| <persistence-unit name="BeanExamples">
| <jta-data-source>java:/DefaultDS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| </properties>
| </persistence-unit>
| </persistence>
Any suggestions? Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966481#3966481
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966481
19 years, 8 months
[JBoss Eclipse IDE (users)] - Re: jboss by debug not avaliable [another error Pop Up?]
by marvin_taboada
Hi, first thing thanks for JBossIDE.
I used JBossIDE 1.5, and 1.6 with no problems, and as you may suppose, I have problems with JBossIDE-2.0.0.Alpha1a.
Eclipse pops up another error dialog (not the '50s Timeout '), it Says 'Server JBOSS 4.0 failed to start', seems pretty much like the 50s timeout (pops up almost the same time).
I checked the log and nothing of help:
!ENTRY org.eclipse.wst.server.core 4 0 2006-08-21 10:32:10.062
!MESSAGE Server JBOSS 4.0 failed to start.
While I was setting the server in the 'JBoss Server View' a error Pop Up, in the log:
!ENTRY org.eclipse.jface 4 2 2006-08-21 11:32:06.328
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
org.eclipse.jface.util.Assert$AssertionFailedException: null argument;
at org.eclipse.jface.util.Assert.isNotNull(Assert.java:150)
...
at org.jboss.ide.eclipse.as.ui.views.JBossServerView$2.selectionChanged(JBossServerView.java:183)
...
at org.eclipse.core.launcher.Main.main(Main.java:952)
I can send the whole stack trace if needed.
This is my dist:
- wtp-sdk-M-1.5.1-200608110237.zip
Which ask for the next deps
- eclipse-sourceBuild-srcIncluded-M20060802-0800.zip
- emf-sdo-runtime-M200608030000.zip
- xsd-runtime-M200608030000.zip
- JEM-SDK-1.2.zip
- GEF-SDK-3.2.zip
Almost forgot, I used the following dist of JBoss-IDE (not the bundle):
- JBossIDE-2.0.0.Alpha1a-ALL.zip [Jul 17, 2006 08:48]
I switched to this dist because of the '50s timeout', willing to use the new JBossAs Adapter (to reduce my deplyment cycle, Hot code replacement).
Now I can select 'Time out: Unlimited', I configure the server (jboss-4.0.4.GA-src dist) from the Windows->Preferences->Server... Even I start the server from the new 'JBoss Server View'
¿Any help, please?, maybe I built upon the wrong dist.
I'm going to try the [JBossIDE-2.0.0.Alpha1a-Bundle-win32.zip][Jul 17, 2006 10:03]
And next [JBossIDE-200608191448-integration-ALL.zip][Aug 20, 2006 12:15] ¿is my current dist able to support it?
Thanks, (¿is OK to post this here?)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966480#3966480
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966480
19 years, 8 months
[Beginners Corner] - Big problem!How to reload a web module without restart the j
by pxpwxj
I deployed a folder whose name is "xxx.war" to under the deploy dirctory of my jboss server.As many people praised:"jboss is excellent in hot deploy",the server can start my web module immediatly.But i still want say:it is very unconvient to reload a web module ,or to reload a servlet under jboss server.I have tried these method below:
1.edit the web.xml file,or the application.xml in the web's META-INF folder ,(in tomcat it will result in the server to reload the web).
2.replace those class file in the web-inf/class folder ,(in tomcat it will result in the server to reload the web).
3.replace the whole web module folder.
all of the methods above won't work!I have to remove the web module,and then copy it to the deploy directory again,or restart the jboss server.It waste me many minutes to do this!
any body can tell me a efficient way! tks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966475#3966475
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966475
19 years, 8 months