[EJB 3.0] - Help on javax.persistence.NonUniqueResultException
by scout1lacno
Hi all,
Im developing and EJB 3.0 application with JBOSS 4.0.4.GA and NB 5.5. Im having an error below:
2006-10-18 14:11:08,690 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/CRM-war].[PlaceBean]] Servlet.service() for servlet PlaceBean threw exception
| javax.ejb.EJBException: javax.persistence.NonUniqueResultException: org.hibernate.NonUniqueResultException: query did not return a unique result: 161
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
The entity:
@Entity
| @Table(name = "tblCountry")
| public class TblCountry implements Serializable {
|
| @Id
| @Column(name = "IDCountry", nullable = false)
| private Integer iDCountry;
|
| @Column(name = "strCountry", nullable = false)
| private String strCountry;
|
| @Column(name = "strRegion")
| private String strRegion;
Does anyone has an idea about this error? A link?
Hope for a kind reply
Thankz :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978978#3978978
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978978
19 years, 8 months
[JBoss Messaging] - Re: Equivalent of null persistence in Jboss Messaging
by vasu_suku@yahoo.com
<?xml version="1.0" encoding="UTF-8"?>
|
| <!--
| Null persistence deployment descriptor.
|
|
| -->
|
| <server>
|
| <mbean code="org.jboss.messaging.core.plugin.NullPersistenceManager"
| name="jboss.messaging:service=PersistenceManager"
| xmbean-dd="xmdesc/NullPersistenceManager-xmbean.xml">
|
| </mbean>
|
|
|
| </server>
============================================
NullPersistenceManager-xbean.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE mbean PUBLIC
| "-//JBoss//DTD JBOSS XMBEAN 1.2//EN"
| "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd">
|
|
|
| <mbean>
| <description>A Null persistence manager</description>
| <class>org.jboss.messaging.core.plugin.NullPersistenceManager</class>
|
| <!-- Managed constructors -->
|
| <!-- Managed attributes -->
|
| <attribute access="read-only" getMethod="getInstance">
| <description>The instance to plug into the server peer</description>
| <name>Instance</name>
| <type>java.lang.Object</type>
| </attribute>
|
|
| <!-- Managed operations -->
|
| <operation>
| <description>JBoss Service lifecycle operation</description>
| <name>create</name>
| </operation>
|
| <operation>
| <description>JBoss Service lifecycle operation</description>
| <name>start</name>
| </operation>
|
| <operation>
| <description>JBoss Service lifecycle operation</description>
| <name>stop</name>
| </operation>
|
| <operation>
| <description>JBoss Service lifecycle operation</description>
| <name>destroy</name>
| </operation>
|
| </mbean>
====================================
This removes the incomplete deployment:
Is this the right implementation? Am i missing anything
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978973#3978973
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978973
19 years, 8 months
[JBoss Messaging] - NullPersistenceManager Implementation
by vasu_suku@yahoo.com
null-persistence-service.xml
<?xml version="1.0" encoding="UTF-8"?>
|
| <!--
| Null persistence deployment descriptor.
| -->
|
| <server>
|
| <mbean code="org.jboss.messaging.core.plugin.NullPersistenceManager"
| name="jboss.messaging:service=PersistenceManager">
|
| </mbean>
|
| </server>
=============================================
NullPersistenceManager.java
/*
| * JBoss, Home of Professional Open Source
| * Copyright 2005, JBoss Inc., and individual contributors as indicated
| * by the @authors tag. See the copyright.txt in the distribution for a
| * full listing of individual contributors.
| *
| * This is free software; you can redistribute it and/or modify it
| * under the terms of the GNU Lesser General Public License as
| * published by the Free Software Foundation; either version 2.1 of
| * the License, or (at your option) any later version.
| *
| * This software is distributed in the hope that it will be useful,
| * but WITHOUT ANY WARRANTY; without even the implied warranty of
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
| * Lesser General Public License for more details.
| *
| * You should have received a copy of the GNU Lesser General Public
| * License along with this software; if not, write to the Free
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
| */
|
| package org.jboss.messaging.core.plugin;
|
|
| import java.util.ArrayList;
| import java.util.List;
|
| import org.jboss.messaging.core.MessageReference;
| import org.jboss.messaging.core.tx.Transaction;
| import org.jboss.logging.Logger;
|
| import org.jboss.messaging.core.plugin.contract.PersistenceManager;
|
|
|
| import org.jboss.system.ServiceMBeanSupport;
|
|
|
|
|
| public class NullPersistenceManager extends ServiceMBeanSupport implements PersistenceManager
| {
| // Constants -----------------------------------------------------
|
| private static final Logger log = Logger.getLogger(NullPersistenceManager.class);
|
|
|
| // Static --------------------------------------------------------
|
| // Attributes ----------------------------------------------------
|
| private boolean trace = log.isTraceEnabled();
|
|
|
| // Constructors --------------------------------------------------
|
| public NullPersistenceManager() throws Exception
| {
|
| }
|
|
|
| // ServiceMBeanSupport overrides ---------------------------------
|
| protected void startService() throws Exception
| {
|
| log.debug(this + " started");
| }
|
| protected void stopService() throws Exception
| {
| log.debug(this + " stopped");
| }
|
| // PersistenceManager implementation -------------------------
|
| public Object getInstance()
| {
| return this;
| }
|
|
| public long reserveIDBlock(String counterName, int size) throws Exception
| {
|
| if (trace)
| {
| log.trace("Getting id block for counter: " + counterName + " ,size: " + size);
| }
|
| return 1;
|
|
| }
|
|
| public void updateReliableReferencesLoadedInRange(long channelID, long orderStart, long orderEnd) throws Exception
| {
| if (trace)
| {
| log.trace("Updating reliable references for channel " + channelID + " between " + orderStart + " and " + orderEnd);
| }
|
|
| }
|
| public int getNumberOfUnloadedReferences(long channelID) throws Exception
| {
| if (trace) { log.trace("getting number of unloaded references for channel [" + channelID + "]"); }
|
|
| return 0;
|
| }
|
|
| public List getMessages(List messageIds) throws Exception
| {
| if (trace)
| {
| log.trace("Getting batch of messages for " + messageIds);
| }
|
|
| return new ArrayList();
|
|
| }
|
|
|
| public void addReferences(long channelID, List references, boolean loaded) throws Exception
| {
|
| }
|
| public void removeReferences(long channelID, List references) throws Exception
| {
| if (trace) { log.trace(this + " Removing " + references.size() + " refs from channel " + channelID); }
|
|
| }
|
| public long getMinOrdering(long channelID) throws Exception
| {
| if (trace)
| {
| log.trace("Getting min ordering for channel " + channelID);
| }
|
|
| return 0;
|
|
| }
|
|
|
| public List getReferenceInfos(long channelID, long minOrdering, int number) throws Exception
| {
| if (trace)
| {
| log.trace("loading message reference info for channel " + channelID + " for " + number + " refs");
| }
|
| List refs = new ArrayList();
|
| return refs;
|
|
| }
|
| public void updateReferencesNotLoaded(long channelID, List references) throws Exception
| {
|
|
| if (trace)
| {
| log.trace("Updating references to not loaded for channel:" + channelID);
| }
|
|
| }
|
| public void addReference(long channelID, MessageReference ref, Transaction tx) throws Exception
| {
|
| }
|
| public void removeReference(long channelID, MessageReference ref, Transaction tx) throws Exception
| {
|
| }
|
| public void resetLoadedStatus(long channelID) throws Exception
| {
| if (trace) { log.trace("resetting all channel data for channel " + channelID); }
|
|
| }
|
|
| public List retrievePreparedTransactions() throws Exception
| {
|
|
| List transactions = new ArrayList();
|
| return transactions;
|
|
| }
|
|
|
| public String toString()
| {
| return "NullPersistenceManager[]";
| }
|
| public String getName()
| {
| return toString();
| }
|
|
|
| }
=============================================
Error during deployment
006-10-17 22:21:29,578 ERROR [org.jboss.deployment.MainDeployer] could not create deployment: file:/C:/work/head/jboss-4.0.2/server/messaging/deploy/jboss-messaging.sar/null-persistence-service.xml
org.jboss.deployment.DeploymentException: Class does not expose a management interface: java.lang.Object; - nested throwable: (javax.management.NotCompliantMBeanException: Class does not expose a management interface: java.lang.Object)
at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:143)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978971#3978971
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978971
19 years, 8 months
[EJB 3.0] - Persistence Unit NOTYETINSTALLED
by Ganton
I am trying to learn EJB3 on 4.0.4GA-Patch1, and am having trouble with my persistence unit.
The whole application is packaged in an EAR, with the entity beans in one jar, the session beans in another jar, and the web-app in a war.
The persistence.xml is packaged in the META-INF directory of the jar containing the entity beans.
I am trying a dependency injection on a stateless session bean, with the following code:
@PersistenceContext(unitName="users")
| protected EntityManager em;
with the following persistence.xml
| <?xml version="1.0" encoding="UTF-8"?>
|
| <persistence>
| <persistence-unit name="users">
| <jta-data-source>java:/usersDS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| </properties>
| </persistence-unit>
| </persistence>
|
and I get the following errors during deployment:
--- MBeans waiting for other MBeans ---
| ObjectName: jboss.j2ee:ear=users.ear,jar=business.jar,name=UserManagerBean,ser
| vice=EJB3
| State: NOTYETINSTALLED
| I Depend On:
| persistence.units:unitName=users
|
| --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
| ObjectName: persistence.units:unitName=users
| State: NOTYETINSTALLED
| Depends On Me:
| jboss.j2ee:ear=forums.ear,jar=business.jar,name=UserManagerBean,service=EJB3
|
|
Anybody know why the persistence unit isn't being registered, or if that is in fact the problem ?
Thanks in advance for help
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978969#3978969
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978969
19 years, 8 months