openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srinivas Budigam <srinivasrao.budi...@emagia.com>
Subject Mapping Problems when mapping one-many and many-one interrelated entities
Date Thu, 07 Jun 2007 12:48:06 GMT

Hi,
 
We are having 4 entity files that are inter-related, The following code
snippet uses entity files 
 
1. public List<LoggerConfig> getLoggerConfigList() throws DaoException {
2.        logger.debug("getLoggerConfigList");
3.        OpenJPAEntityManager session = null;
4.        List<LoggerConfig> configList = new ArrayList<LoggerConfig>();
5        try {
6            session = ServiceLocator.getOpenJPASession("host");
7            OpenJPAQuery query = session.createNativeQuery("select * from 
LOGGER_CONFIG where HOST_ID is null",LoggerConfigDTO.class);
8            List<LoggerConfigDTO> configDTOs =query.getResultList();
9            for (LoggerConfigDTO configDTO : configDTOs) {
10                //debug("getLoggerConfigList " + configDTO.toString());
11                configList.add(configDTO.toLoggerConfig());
12            }
13        } catch (Exception e) {
14            throw DaoException.getDaoException(e, logger);
15        } finally {
16            if (session != null && session.isOpen()) {
17                session.close();
18            }
19        }
20        return configList;
21    }
 
and while retriving the data in the above code at line number 8 throws the
following exception.
Please find the Entity files as an attachement to this mail and following is
the stack trace that 
is getting displayed on the console. Please help us in resolving this issue.
 
 
2007-06-01 20:09:12,976 INFO  [com.server.logger.LoggerUtil] Returning audit
logger from Logger Util
2007-06-01 20:09:17,522 ERROR
[com.server.dao.config.hibernate.ConfigDAOImpl] An internal error occurred
on the Security Server. Refer to cgss.log and server.log for details. Call
support if necessary.
<0.9.7-incubating fatal user error>
org.apache.openjpa.persistence.ArgumentException: Errors encountered while
resolving metadata.  See nested exceptions for details.
 at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:506)
 at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:288)
 at org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:704)
 at
org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:683)
 at
org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:665)
 at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1483)
 at
org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
 at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:219)
 at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:269)
 at
com.server.dao.config.hibernate.ConfigDAOImpl.getLoggerConfigList(ConfigDAOImpl.java:605)
 at com.server.config.ConfigUtil.getLoggerConfigList(ConfigUtil.java:506)
 at
com.server.mgmt.ConsoleManagement.getLoggerConfigList(ConsoleManagement.java:591)
 at
com.server.mgmt.console.config.LoggerConfigAction.execute(LoggerConfigAction.java:96)
 at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
 at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at
com.server.mgmt.console.access.AuthorizationFilter.doFilter(AuthorizationFilter.java:70)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
 at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
 at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
 at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
 at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
 at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
 at java.lang.Thread.run(Thread.java:803)
Caused by: 
<0.9.7-incubating fatal user error>
org.apache.openjpa.persistence.ArgumentException: Field
"com.server.dao.config.AppenderConfigDTO.properties" cannot declare that it
is mapped by another field. Its mapping strategy
(org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy) does not support
mapping by another field.
 at
org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy.assertNotMappedBy(AbstractFieldStrategy.java:59)
 at
org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.map(HandlerFieldStrategy.java:70)
 at
org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:120)
 at
org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
 at
org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:438)
 at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403)
 at
org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:823)
 at
org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:319)
 at
org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:605)
 at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:492)
 ... 40 more
NestedThrowables:
java.lang.NullPointerException
 at
org.apache.openjpa.jdbc.meta.FieldMapping.initializeMapping(FieldMapping.java:486)
 at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:405)
 at
org.apache.openjpa.jdbc.meta.ClassMapping.initializeMapping(ClassMapping.java:834)
 at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1590)
 at
org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:629)
 at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:498)
 at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:288)
 at org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:704)
 at
org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:683)
 at
org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:665)
 at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1483)
 at
org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
 at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:219)
 at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:269)
 at
com.server.dao.config.hibernate.ConfigDAOImpl.getLoggerConfigList(ConfigDAOImpl.java:605)
 at com.server.config.ConfigUtil.getLoggerConfigList(ConfigUtil.java:506)
 at
com.server.mgmt.ConsoleManagement.getLoggerConfigList(ConsoleManagement.java:591)
 at
com.server.mgmt.console.config.LoggerConfigAction.execute(LoggerConfigAction.java:96)
 at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
 at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at
com.server.mgmt.console.access.AuthorizationFilter.doFilter(AuthorizationFilter.java:70)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
 at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
 at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
 at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
 at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
 at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
 at java.lang.Thread.run(Thread.java:803)
2007-06-01 20:09:17,529 ERROR [com.server.config.ConfigUtil] Unable to
obtain list of default loggers.
com.server.dao.DaoException: An internal error occurred on the Security
Server. Refer to cgss.log and server.log for details. Call support if
necessary.
 at com.server.dao.DaoException.getDaoException(DaoException.java:64)
 at
com.server.dao.config.hibernate.ConfigDAOImpl.getLoggerConfigList(ConfigDAOImpl.java:611)
 at com.server.config.ConfigUtil.getLoggerConfigList(ConfigUtil.java:506)
 at
com.server.mgmt.ConsoleManagement.getLoggerConfigList(ConsoleManagement.java:591)
 at
com.server.mgmt.console.config.LoggerConfigAction.execute(LoggerConfigAction.java:96)
 at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
 at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at
com.server.mgmt.console.access.AuthorizationFilter.doFilter(AuthorizationFilter.java:70)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
 at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
 at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
 at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
 at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
 at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
 at java.lang.Thread.run(Thread.java:803)
Caused by: 
<0.9.7-incubating fatal user error>
org.apache.openjpa.persistence.ArgumentException: Errors encountered while
resolving metadata.  See nested exceptions for details.
 at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:506)
 at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:288)
 at org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:704)
 at
org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:683)
 at
org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:665)
 at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1483)
 at
org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
 at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:219)
 at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:269)
 at
com.server.dao.config.hibernate.ConfigDAOImpl.getLoggerConfigList(ConfigDAOImpl.java:605)
 ... 31 more
Caused by: 
<0.9.7-incubating fatal user error>
org.apache.openjpa.persistence.ArgumentException: Field
"com.server.dao.config.AppenderConfigDTO.properties" cannot declare that it
is mapped by another field. Its mapping strategy
(org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy) does not support
mapping by another field.
 at
org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy.assertNotMappedBy(AbstractFieldStrategy.java:59)
 at
org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.map(HandlerFieldStrategy.java:70)
 at
org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:120)
 at
org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
 at
org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:438)
 at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403)
 at
org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:823)
 at
org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:319)
 at
org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:605)
 at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:492)
 ... 40 more

Thanks in Advance,
Srinivas.B http://www.nabble.com/file/p11007291/files.zip files.zip 
http://www.nabble.com/file/p11007291/files.zip files.zip 
-- 
View this message in context: http://www.nabble.com/Mapping-Problems-when-mapping-one-many-and-many-one-interrelated-entities-tf3883675.html#a11007291
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Mime
View raw message