[Persistence, JBoss/CMP, Hibernate, Database] - Saving data in Hibernate
by Xpoft
JBoss 4.0.4, Hibernate 3.0. Data do not saved!
Code in EJB component:
| ctx = new InitialContext();
| SessionFactory factory = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory");
| Session hsession = factory.openSession();
| Transaction tx = hsession.beginTransaction();
| Orgs orgs = new Orgs("Hibernate test");
| hsession.save(orgs);
| tx.commit();
| hsession.close();
|
In hibernate.org FAQ: wrote
anonymous wrote :
| I saved / deleted / updated an object / collection but I can't see the changes in the database!
|
| Hibernate will not execute any SQL until you either call Transaction.commit() (if using the Transaction API) or Session.flush() (if you are not) at the end of a session to flush your in-memory changes to the database.
|
| If you are not using the Transaction API, you must then explicitly commit the transaction (by committing the JTA transaction or JDBC Connection).
|
Therefor on "Transaction.commit()" SQL query must be execute. But do not do that, while not execute "hsession.flush()".
But in FAQ wrote, that "Session.flush()" must be using when we do not have Transaction.
Where I'm wrong?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960123#3960123
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960123
19 years, 9 months
[JBoss Seam] - Re: Seam Application Deployment
by koriel
"koriel" wrote : Ok I'm having some problems with seam...I have defined a simple class which is
| |
| |
| | @Stateless
| | @Name("myejb")
| | public class TestEjb implements Test {
| |
| | /**
| | *
| | */
| |
| | private String mystring="hi koriel";
| |
| | /* (non-Javadoc)
| | * @see uai.utilities.Test#getMystring()
| | */
| | public String getMystring() {
| | return mystring;
| | }
| |
| | /* (non-Javadoc)
| | * @see uai.utilities.Test#setMystring(java.lang.String)
| | */
| | public void setMystring(String mystring) {
| | this.mystring = mystring;
| | }
| |
| |
| |
| | }
| |
| |
|
| and in my home.xhtml page I have this
|
|
| |
| | <h:outputText value="#{myejb.mystring}" />
| |
| |
|
| but I can't see the string "hi koriel" when I access home.xthml. What am I doing wrong?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960121#3960121
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960121
19 years, 9 months
[JBoss Seam] - Seam Application Deployment
by koriel
Ok I'm having some problems with seam...I have defined a simple class which is
|
|
| @Stateless
| @Name("myejb")
| public class TestEjb implements Serializable {
|
| /**
| *
| */
|
| private String mystring="hi koriel";
|
| /* (non-Javadoc)
| * @see uai.utilities.Test#getMystring()
| */
| public String getMystring() {
| return mystring;
| }
|
| /* (non-Javadoc)
| * @see uai.utilities.Test#setMystring(java.lang.String)
| */
| public void setMystring(String mystring) {
| this.mystring = mystring;
| }
|
|
|
| }
|
|
and in my home.xhtml page I have this
|
| <h:outputText value="#{myejb.mystring}" />
|
|
but I can't see the string "hi koriel" when I access home.xthml. What am I doing wrong?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960117#3960117
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960117
19 years, 9 months
[JBoss Seam] - Configuration problems in seam CVS for TestNG eclipse plugin
by andygrav
There seems to be a configuration problem for TestNG in the jboss seam CVS.
I followed the instructions in the flash demo
http://www.jboss.com/products/seam/EclipseCVS.html
Downloading the Seam from CVS as the demo explains
I installed the latest TestNG plugin for eclipse as explained in the TestNG site
Then I tried to run the test case for the numberguess sample
There seems to be a configuration problem.
for example a components.xml
exists in the WEB-INF directory of the numberguess example
however in the trace below it says its not found.
I saw in another post that embedded-ejb/conf should be on the classpath which it is.
Please can someone explain what to do.
Also it would be cool if the flash demo could be updated to explain how to do it, for others not to fall into the same trap as me.
Thanks in advance
Andy Bailey
Hazlorealidad.com
08:28:49,781 INFO [Initialization] no components.xml file found
08:28:49,781 INFO [Initialization] reading properties from: /jndi.properties
08:28:49,781 INFO [Initialization] initializing Seam
08:28:49,828 INFO [Component] Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Init
08:28:49,937 INFO [Component] Component: org.jboss.seam.core.pages, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Pages
08:28:49,953 INFO [Component] Component: events, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Events
08:28:49,968 INFO [Component] Component: org.jboss.seam.core.manager, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.core.Manager
08:28:50,000 INFO [Component] Component: switcher, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.Switcher
08:28:50,000 INFO [Component] Component: redirect, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.Redirect
08:28:50,015 INFO [Component] Component: httpError, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.HttpError
08:28:50,031 INFO [Component] Component: userPrincipal, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.UserPrincipal
08:28:50,031 INFO [Component] Component: isUserInRole, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.IsUserInRole
08:28:50,031 INFO [Component] Component: conversation, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.Conversation
08:28:50,046 INFO [Component] Component: conversationList, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationList
08:28:50,062 INFO [Component] Component: conversationStack, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationStack
08:28:50,093 INFO [Component] Component: facesContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.FacesContext
08:28:50,093 INFO [Component] Component: pageContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.PageContext
08:28:50,093 INFO [Component] Component: eventContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.EventContext
08:28:50,109 INFO [Component] Component: sessionContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.SessionContext
08:28:50,109 INFO [Component] Component: statelessContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.StatelessContext
08:28:50,125 INFO [Component] Component: applicationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.ApplicationContext
08:28:50,125 INFO [Component] Component: conversationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationContext
08:28:50,125 INFO [Component] Component: businessProcessContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.BusinessProcessContext
08:28:50,140 INFO [Component] Component: locale, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.Locale
08:28:50,140 INFO [Component] Component: messages, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.Messages
08:28:50,140 INFO [Component] Component: theme, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.theme.Theme
08:28:50,156 INFO [Component] Component: themeSelector, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.theme.ThemeSelector
08:28:50,156 INFO [Component] Component: interpolator, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.Interpolator
08:28:50,218 INFO [Component] Component: facesMessages, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.FacesMessages
08:28:50,234 INFO [Component] Component: resourceBundle, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.ResourceBundle
08:28:50,234 INFO [Component] Component: localeSelector, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.LocaleSelector
08:28:50,250 INFO [Component] Component: uiComponent, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.UiComponent
08:28:50,250 INFO [Component] Component: renderParameters, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.core.RenderParameters
08:28:50,250 INFO [Component] Component: org.jboss.seam.remoting.messaging.subscriptionRegistry, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.remoting.messaging.SubscriptionRegistry
08:28:50,265 INFO [Component] Component: pojoCache, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.PojoCache
08:28:50,281 INFO [Initialization] done initializing Seam
08:28:50,312 INFO [Pages] no pages.xml file found
FAILED: testNumberGuessLose
java.lang.NullPointerException
at org.jboss.seam.example.numberguess.test.NumberGuessTest$4.renderResponse(NumberGuessTest.java:124)
at org.jboss.seam.mock.SeamTest$Script.run(SeamTest.java:266)
at org.jboss.seam.example.numberguess.test.NumberGuessTest.testNumberGuessLose(NumberGuessTest.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:552)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:411)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:785)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:686)
at org.testng.TestRunner.run(TestRunner.java:566)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:221)
at org.testng.SuiteRunner.run(SuiteRunner.java:145)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:811)
at org.testng.TestNG.runSuitesLocally(TestNG.java:774)
at org.testng.TestNG.run(TestNG.java:538)
at org.testng.eclipse.runner.RemoteTestNG.run(RemoteTestNG.java:80)
at org.testng.eclipse.runner.RemoteTestNG.main(RemoteTestNG.java:122)
FAILED: testNumberGuessWin
java.lang.NullPointerException
at org.jboss.seam.example.numberguess.test.NumberGuessTest$1.renderResponse(NumberGuessTest.java:29)
at org.jboss.seam.mock.SeamTest$Script.run(SeamTest.java:266)
at org.jboss.seam.example.numberguess.test.NumberGuessTest.testNumberGuessWin(NumberGuessTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:552)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:411)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:785)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:686)
at org.testng.TestRunner.run(TestRunner.java:566)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:221)
at org.testng.SuiteRunner.run(SuiteRunner.java:145)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:811)
at org.testng.TestNG.runSuitesLocally(TestNG.java:774)
at org.testng.TestNG.run(TestNG.java:538)
at org.testng.eclipse.runner.RemoteTestNG.run(RemoteTestNG.java:80)
at org.testng.eclipse.runner.RemoteTestNG.main(RemoteTestNG.java:122)
===============================================
NumberGuess
Tests run: 2, Failures: 2, Skips: 0
===============================================
===============================================
NumberGuess
Total tests run: 2, Failures: 2, Skips: 0
===============================================
Creating c:\jbossIde\workspace\jboss-seam\toc.html
Creating c:\jbossIde\workspace\jboss-seam\NumberGuess.properties
Creating c:\jbossIde\workspace\jboss-seam\index.html
Creating c:\jbossIde\workspace\jboss-seam\main.html
Creating c:\jbossIde\workspace\jboss-seam\groups.html
Creating c:\jbossIde\workspace\jboss-seam\methods.html
Creating c:\jbossIde\workspace\jboss-seam\methods-alphabetical.html
Creating c:\jbossIde\workspace\jboss-seam\classes.html
Creating c:\jbossIde\workspace\jboss-seam\reporter-output.html
Creating c:\jbossIde\workspace\jboss-seam\methods-not-run.html
Creating c:\jbossIde\workspace\jboss-seam\testng-failures.xml
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960113#3960113
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960113
19 years, 9 months