[EJB 3.0] - Problem with native query
by TerRamekh
Hello!
I have experienced a problem using native query for selecting CHAR(3) column from DB.
The code is:
| @Stateless
| public class NtrBean implements NtrRemote
| {
| @PersistenceContext(unitName = "probe")
| EntityManager entityManager;
|
| public String getMeasure(Long tnvedId) throws Exception
| {
| Query getMeasureQuery = entityManager.createNativeQuery("select test from test_table where id = :id");
| getMeasureQuery.setParameter("id", tnvedId);
| try
| {
| return (String)getMeasureQuery.getSingleResult();
| }
| catch(NoResultException ex)
| {
| return null;
| }
| }
| }
|
As a result of executing of the code snippet I get:
| javax.ejb.EJBException: java.lang.ClassCastException: java.lang.Character
|
So, here it is: native query selects CHAR(3) as one Character object. If I have 'her' value in my 'test' column, then I get 'h'.
I couldn't find any reasonable explanation of this. I've tried this on Informix 9.4 and MySQL 5.0 DB's and had the same effect.
When
| Query getMeasureQuery = entityManager.createNativeQuery("select test from test_table where id = :id");
|
is replaced by:
| Query getMeasureQuery = entityManager.createQuery("select ts.test from TestTable as ts where ts.id = :id");
|
everything works just great.
I don't think problem could reside in my DB-Java mappings in standardjbosscmp-jdbc.xm as I've already tried to play with it.
Could anyone help me?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966637#3966637
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966637
19 years, 8 months
[JBoss jBPM] - NullPointerException while trying to add ActionHandler
by dveermanster
Hey,
I am trying work with GPD 3.0.8 on Eclipse 3.2
I've followed the steps of the "getting started" of GPD, till 4.2 "integrating Hello Action" because I click 'add action' and get a pop-up in which I can fill in the name and browse to the preferred action class but when I click oke I get the message to look in de log file because of an error:
!ENTRY org.eclipse.jface 4 0 2006-08-22 11:16:15.312
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
at org.jbpm.ui.properties.ActionHandlerPropertyPage.performOk(Unknown Source)
at org.eclipse.jface.preference.PreferenceDialog$11.run(PreferenceDialog.java:889)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:843)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:869)
at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:377)
at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:230)
at org.eclipse.jface.dialogs.Dialog$3.widgetSelected(Dialog.java:660)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
at org.eclipse.jface.window.Window.open(Window.java:796)
at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:156)
at org.jbpm.ui.part.tree.ElementTreeEditPart.openPropertyDialog(Unknown Source)
at org.jbpm.ui.part.tree.ElementTreeEditPart.performRequest(Unknown Source)
at org.jbpm.ui.outline.DesignerOutlineViewer.handleDoubleClick(Unknown Source)
at org.jbpm.ui.outline.DesignerOutlineViewer.access$3(Unknown Source)
at org.jbpm.ui.outline.DesignerOutlineViewer$4.mouseDoubleClick(Unknown Source)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:141)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
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.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Also tried it with the added MessageActionHandler class which was already in the GPD package but got the same error.
Does anyone have a clue what might be the problem?
thanks in advance!
p.s. I found that with my configuration the JpdlXmlReader.parseProcessDefinition method used in the HelloTest.java in the tutorial does not exist, so I had to change code into:
import org.xml.sax.InputSource;
:
:
InputSource inputsource =
new InputSource("src/java/hello.par/processdefinition.xml");
JpdlXmlReader reader = new JpdlXmlReader(inputsource);
ProcessDefinition definition = reader.readProcessDefinition();
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966635#3966635
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966635
19 years, 8 months
[JBoss Seam] - Re: When are components created?
by SmokingAPipe
This seems like a step backwards from JSP. Here's the problem I'm facing:
I have a signup form where users can select their country. There are about 200 countries, and a I have an enum that lists them all, and within that enum class there is also a static member which is a Map<String,String> that maps keys of country codes ("US") to values of country names ("United States"). Pretty basic stuff.
It seems like I should be able to use that Map as the value of a selectItems component.
But I cannot find any way to get that Java Map visible within the JSF!
I have a SFSB that also is the bean that processes the form. I put in a getCountryMap() method in that that always returns this map. But whenever I try to display the page, that doesn't work, because when the page is first displayed, that SFSB has not yet been instantiated, even though it has an EVENT scope.
So... this is ridiculous. There must be some way to display simple Java objects within JSF. Is there some way I could inject that Map into one of Seam's contexts?
Hard things, like redisplaying a form, are very easy in Seam, but simple things, like display some dumb Java objects, are difficult or impossible it appears.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966632#3966632
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966632
19 years, 8 months