One to many chat in java
is there any way to provide One to many chatting on LAN. i am trying to do that but i am not able to construct the basic architecture that how actually it should work.
if anybody who is having any idea that what should be the basic architecture of One to many chatting on LAN then please reply.
thank you
shadtab wrote:
is there any way to provide One to many chatting on LAN. i am trying to do that but i am not able to construct the basic architecture that how actually it should work.
if anybody who is having any idea that what should be the basic architecture of One to many chatting on LAN then please reply.
thank youI've made a simple one to many chatting using JMS topic subscriber/publisher
Similar Messages
-
Hi,
I had been trying to implement One to Many Chat functionality in one of my Flex Apps. After banging my head at so many places I finally came to know about Adobe LCCS and It seems to be doing the trick very well. However, I am facing some roadblocks in implementing this on my server. Would be really great if any of the experts out here can guide me in the appropriate direction.
Actually I am trying to make a platform where our agents will be answering to the queries of our end users in a real time. So in that case, I am planning to create a separate room for each of the agents. (We don't really need to create rooms dynamically as the number of agents is limited). Now after the end users have selected their preferred agent, I want them to be able to chat with that particular agent only. However, one agent should be able to talk to multiple end users at the same time.
I tried to use the simple chat component and that is working very smoothly. However I am facing problems with the default drop down menu that comes with it. I want the following to conditions to be satisfied...
1. If an agent logs in, he should be able to see all the users in the drop down menu, select the user and respond to his query with a private message. The current Simple Chat application does exactly the same. And we are fine till this point.
2. If an end user logs in, he should be able to see only the agent in that drop down menu and in fact the drop down menu should be disabled for him.
Tried to explore the things in the documentation and tutorials but I could not really figure out a way to do this. Is there a way to do it without really playing around with the source code.
Thanks a lot in advance.
Luck.Ok
First of all can either of you reach the tset accounts ?
http://www.ralphjohnsuk.dsl.pipex.com/ContactTesters.html
At the PC end have they
1) Tuned the app
this is now accessed from the MY AIM menu but when you get to the properties the instructions are then the same.
2) Open the XP firewall to the AIM application. This allows ports 1024 to 5000 in the XP Service PAck 2 firewall to be open.
3) Set the same in her modem and other firewall ?
6:52 PM Wednesday; April 12, 2006 -
One to many relationship using java collections
I am facing issue on how to store and then retrieve data . In my program which is simple java class i am retrieving data at 3 places from an xml. i need to store this temporarly in particular fashion as data is related and needed to be used later on at end program to generate report.
first data i am retireving is employee names eg Tom , Reggie, Martha.
Second data is department (Each employee belongs to 1 or many department ) so in this case
Tom : Billing
Reggie : Admin , HR
Martha : IT
Third data is Department number (This has 1 : 1 relationship with Department )
Billing :01
Admin :02
HR:03
IT:04
So when i am parsing xml first i am getting employee data, then department and lastly department number. I need to store it in collection in such way later on i can retireve and link data and use it.....
Which java collections i should use....
Any hints or guidance ....Well, the simplest approach is to initially load the employees objects into a List<Employee>. Initially they store the department number only. Then load the departments, probably into a Map<Integer, Department>. Having popluated such a map you then loop through the Employee list, connecting looking up the deparment number in the map and connecting Employee to Department as you wish. (An Employee would probably had a reference to the Department, the Department might contain a List<Employee>).
The implementations to use depend on how you'll use them. HashMaps are faster than TreeMaps, but a TreeMap orders. LinkedLists are faster to process in sequence than ArrayList, slower to process at random. -
Urgent : java bean having bidirectional one to many relationship
Hi,
We have complex requirement in our application.
We need to copy java bean having bidirectional one to many relationship to another javabean having bidirectional one to many relationship..
E.g
Class Basket1 {
public String color;
pubic String type;
public List<Basket1> basketList = new ArrayList()
Class Basket2 {
public String color;
pubic String type;
public List<Basket2> basketList = new ArrayList()
We need to exact copy Basket1 to Basket2. We are in trouble to copy List of child because we do not have how many child Basket1 have of same type..
Can someone help us how we can implement such kind of complex object bidirectional one to many relationship??I can't see anything bidirectional about these relationships. What I can see is a couple of BasketN classes that look identical so I don't know why they both exist, and they both contain lists of themselves as members, which suggests some kind of tree structure. Nothing bidirectional there. I can see tat these things can form circular object graphs but I don't see why you would want to do that.
We need to exact copy Basket1 to Basket2And I don't know what that means. Please explain. -
Java.io.NotSerializableException - while retriving "one to many" objects
i am getting java.rmi.MarshalException java.io.NotSerializableException
while i try to retrive one to many objects
i have recently migrated from kodo 2.5.x to kodo 3.0.1, and i have parent
object reference in child objects (reverse mapping reference according to
kodo 2.5.x) as shown below
public class BankStatementEntry implements BankStatement {
private Set accountSummary = new HashSet();
public interface BankStatement extends Serializable {
* Returns the accountSummary.
* @return Map
public Set getAccountSummary();
* Returns the accountSummary.
* @return Map
public void setAccountSummary(Set accountSummary);
public class AccountSummaryRecord implements AccountSummary {
private BankStatementEntry bankStatementEntry;
public interface AccountSummary extends Serializable {
* Returns the transactionDetails.
* @return Collection
public Set getTransactionDetails();
the problem is, when i try to retrive BankStatementEntry object, i have to
iterate through each child (AccountSummaryRecord) object and manualy
remove parent object reference (BankStatementEntry) by setting null.
Otherwise EJB throws java.io.NotSerializableException
Is this bug ?
Thanks
karup.Thread [Servlet.Engine.Transports : 1] (Suspended)
java.io.NotSerializableException.<init>() line: 50 [local variables
unavailable]
com.ibm.CORBA.iiop.UtilDelegateImpl.copyObjectByProxy(java.lang.Object,
org.omg.CORBA.ORB, java.lang.ClassLoader, java.lang.Class,
org.omg.CORBA.portable.Streamable) line: 1316 [local variables unavailable]
com.ibm.ws.orb.WSUtilDelegateImpl(com.ibm.CORBA.iiop.UtilDelegateImpl).copyObject(java.lang.Object,
org.omg.CORBA.ORB) line: 771 [local variables unavailable]
javax.rmi.CORBA.Util.copyObject(java.lang.Object, org.omg.CORBA.ORB)
line: 327 [local variables unavailable]
au.com.aig.aiaa.paymentdishonor.process.ejb._BankStatementProcessor_Stub.fetchBankStatement(java.util.Date,
java.util.Date) line: 366
au.com.aig.aiaa.business.process.ejb.CommonFacadeBean.fetchBankStatement(java.util.Date,
java.util.Date) line: 102
au.com.aig.aiaa.business.process.ejb.EJSRemoteStatelessCommonFacade_aa40cc36.fetchBankStatement(java.util.Date,
java.util.Date) line: 61
au.com.aig.aiaa.business.process.ejb._CommonFacade_Stub.fetchBankStatement(java.util.Date,
java.util.Date) line: 266
au.com.aig.aiaa.paymentdishonor.web.ReportsAction.execute(org.apache.struts.action.ActionMapping,
org.apache.struts.action.ActionForm,
javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 67
org.apache.struts.action.RequestProcessor.processActionPerform(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, org.apache.struts.action.Action,
org.apache.struts.action.ActionForm,
org.apache.struts.action.ActionMapping) line: 446
org.apache.struts.action.RequestProcessor.process(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 266
org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 1292
org.apache.struts.action.ActionServlet.doGet(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 492
org.apache.struts.action.ActionServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 740
org.apache.struts.action.ActionServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 853
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 110 [local variables unavailable]
com.ibm.ws.webcontainer.servlet.StrictServletInstance(com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet)._service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 174 [local variables unavailable]
com.ibm.ws.webcontainer.servlet.IdleServletState.service(com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet,
javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 313
[local variables unavailable]
com.ibm.ws.webcontainer.servlet.StrictServletInstance(com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet).service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 116 [local variables unavailable]
com.ibm.ws.webcontainer.servlet.ServletInstance.service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse,
com.ibm.ws.webcontainer.webapp.WebAppServletInvocationEvent) line: 258
[local variables unavailable]
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(com.ibm.ws.webcontainer.servlet.ServletInstanceReference,
javax.servlet.ServletRequest, javax.servlet.ServletResponse,
com.ibm.ws.webcontainer.webapp.WebAppServletInvocationEvent) line: 42
[local variables unavailable]
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(javax.servlet.ServletRequest,
javax.servlet.ServletResponse,
com.ibm.ws.webcontainer.webapp.WebAppServletInvocationEvent) line: 40
[local variables unavailable]
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(com.ibm.ws.webcontainer.webapp.WebAppRequest,
javax.servlet.http.HttpServletResponse) line: 872 [local variables
unavailable]
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(javax.servlet.ServletRequest,
javax.servlet.ServletResponse, boolean) line: 491 [local variables
unavailable]
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 173 [local variables unavailable]
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 79 [local variables
unavailable]
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(java.lang.Object)
line: 199 [local variables unavailable]
com.ibm.ws.webcontainer.srt.WebAppInvoker(com.ibm.ws.webcontainer.cache.invocation.CachedInvocation).handleInvocation(java.lang.Object)
line: 71 [local variables unavailable]
com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(java.lang.Object)
line: 114 [local variables unavailable]
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(java.lang.String,
com.ibm.ws.webcontainer.srp.ISRPConnection) line: 187 [local variables
unavailable]
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(com.ibm.ws.webcontainer.oselistener.api.IOSEConnection)
line: 331 [local variables unavailable]
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest() line: 56
[local variables unavailable]
com.ibm.ws.webcontainer.http.HttpConnection(com.ibm.ws.http.HttpConnection).readAndHandleRequest()
line: 432 [local variables unavailable]
com.ibm.ws.webcontainer.http.HttpConnection(com.ibm.ws.http.HttpConnection).run()
line: 343 [local variables unavailable]
com.ibm.ws.util.ThreadPool$Worker.run() line: 592 [local variables
unavailable] -
Unable to read one-to-many relations using Hibernate
Hi,
I am trying with a very simple one-to-many relationship. When I am storing the objects, there are no problems. But when I am trying to read out the collection, it says invalid descriptor index. Please help.
Regards,
Hibernate version:
hibernate-3.1rc2
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Parent">
<id name="id">
<generator class="identity"/>
</id>
<set name="children">
<key column="parent_id"/>
<one-to-many class="Child"/>
</set>
</class>
<class name="Child">
<id name="id">
<generator class="identity"/>
</id>
<property name="name"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
The Parent class:
public class Parent
private Long id ;
private Set children;
Parent(){}
public Long getId()
return id;
public void setId(Long id)
this.id=id;
public Set getChildren()
return children;
public void setChildren(Set children)
this.children=children;
The Child class:
public class Child
private Long id;
private String name;
Child(){}
public Long getId()
return id;
private void setId(Long id)
this.id=id;
public String getName()
return name;
public void setName(String name)
this.name=name;
The Main class:
public class PCManager
public static void main(String[] args)
PCManager mgr = new PCManager();
List lt = null;
if (args[0].equals("store"))
mgr.createAndStoreParent(new HashSet(3));
else if (args[0].equals("list"))
mgr.listEvents();
HibernateUtil.getSessionFactory().close();
private void createAndStoreParent(HashSet s)
HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
Parent p1 = new Parent();
int size = 3;
for (int i=size; i>0; i--)
Child c = new Child();
c.setName("Child"+i);
s.add(c);
p1.setChildren (s);
Iterator elems = s.iterator();
do {
Child ch = (Child) elems.next();
HibernateUtil.getSessionFactory().getCurrentSession().save(ch);
}while(elems.hasNext());
HibernateUtil.getSessionFactory().getCurrentSession().save(p1);
HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
private void listEvents()
HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
Parent result = (Parent) HibernateUtil.getSessionFactory().getCurrentSession().load(Parent.class, new Long(1));
System.out.println("Id is :"+ result.getId());
Set children = result.getChildren();
Iterator elems = children.iterator();
do {
Child ch = (Child) elems.next();
System.out.println("Child Name"+ ch.getName());
}while(elems.hasNext());
HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
Full stack trace of any exception that occurs:
When I run with "hbm2ddl.auto" property as validate and trying to list the contents, I get the following out put.
C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc2\MyHibernate>ant run -Da
ction=list
Buildfile: build.xml
clean:
[delete] Deleting directory C:\Documents and Settings\mirza\Desktop\hibernate
-3.1rc2\MyHibernate\bin
[mkdir] Created dir: C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc
2\MyHibernate\bin
copy-resources:
[copy] Copying 4 files to C:\Documents and Settings\mirza\Desktop\hibernate
-3.1rc2\MyHibernate\bin
compile:
[javac] Compiling 5 source files to C:\Documents and Settings\mirza\Desktop\
hibernate-3.1rc2\MyHibernate\bin
run:
[java] 09:09:23,433 INFO Environment:474 - Hibernate 3.1 rc2
[java] 09:09:23,449 INFO Environment:489 - loaded properties from resource
hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate
.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dial
ect=org.hibernate.dialect.SQLServerDialect, hibernate.max_fetch_depth=1, hiberna
te.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.
substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.cac
he.region_prefix=hibernate.test, hibernate.jdbc.batch_versioned_data=true, hiber
nate.connection.pool_size=1}
[java] 09:09:23,465 INFO Environment:519 - using java.io streams to persis
t binary types
[java] 09:09:23,465 INFO Environment:520 - using CGLIB reflection optimize
r
[java] 09:09:23,481 INFO Environment:550 - using JDK 1.4 java.sql.Timestam
p handling
[java] 09:09:23,559 INFO Configuration:1257 - configuring from resource: /
hibernate.cfg.xml
[java] 09:09:23,559 INFO Configuration:1234 - Configuration resource: /hib
ernate.cfg.xml
[java] 09:09:23,872 INFO Configuration:460 - Reading mappings from resourc
e: PCMapping.hbm.xml
[java] 09:09:24,013 INFO HbmBinder:266 - Mapping class: Parent -> Parent
[java] 09:09:24,045 INFO HbmBinder:266 - Mapping class: Child -> Child
[java] 09:09:24,045 INFO Configuration:1368 - Configured SessionFactory: n
ull
[java] 09:09:24,061 INFO Configuration:1014 - processing extends queue
[java] 09:09:24,061 INFO Configuration:1018 - processing collection mappin
gs
[java] 09:09:24,061 INFO HbmBinder:2233 - Mapping collection: Parent.child
ren -> Child
[java] 09:09:24,076 INFO Configuration:1027 - processing association prope
rty references
[java] 09:09:24,076 INFO Configuration:1049 - processing foreign key const
raints
[java] 09:09:24,155 INFO DriverManagerConnectionProvider:41 - Using Hibern
ate built-in connection pool (not for production use!)
[java] 09:09:24,170 INFO DriverManagerConnectionProvider:42 - Hibernate co
nnection pool size: 1
[java] 09:09:24,170 INFO DriverManagerConnectionProvider:45 - autocommit m
ode: false
[java] 09:09:24,170 INFO DriverManagerConnectionProvider:80 - using driver
: sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:MySQL
[java] 09:09:24,170 INFO DriverManagerConnectionProvider:86 - connection p
roperties: {}
[java] 09:09:24,264 INFO SettingsFactory:77 - RDBMS: Microsoft SQL Server,
version: 08.00.0194
[java] 09:09:24,264 INFO SettingsFactory:78 - JDBC driver: JDBC-ODBC Bridg
e (SQLSRV32.DLL), version: 2.0001 (03.85.1117)
[java] 09:09:24,296 INFO Dialect:100 - Using dialect: org.hibernate.dialec
t.SQLServerDialect
[java] 09:09:24,311 INFO TransactionFactoryFactory:31 - Using default tran
saction strategy (direct JDBC transactions)
[java] 09:09:24,327 INFO TransactionManagerLookupFactory:33 - No Transacti
onManagerLookup configured (in JTA environment, use of read-write or transaction
al second-level cache is not recommended)
[java] 09:09:24,327 INFO SettingsFactory:125 - Automatic flush during befo
reCompletion(): disabled
[java] 09:09:24,327 INFO SettingsFactory:129 - Automatic session close at
end of transaction: disabled
[java] 09:09:24,343 INFO SettingsFactory:144 - Scrollable result sets: ena
bled
[java] 09:09:24,343 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
isabled
[java] 09:09:24,343 INFO SettingsFactory:160 - Connection release mode: au
to
[java] 09:09:24,358 INFO SettingsFactory:184 - Maximum outer join fetch de
pth: 1
[java] 09:09:24,358 INFO SettingsFactory:187 - Default batch fetch size: 1
[java] 09:09:24,358 INFO SettingsFactory:191 - Generate SQL with comments:
disabled
[java] 09:09:24,358 INFO SettingsFactory:195 - Order SQL updates by primar
y key: disabled
[java] 09:09:24,358 INFO SettingsFactory:338 - Query translator: org.hiber
nate.hql.ast.ASTQueryTranslatorFactory
[java] 09:09:24,374 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTran
slatorFactory
[java] 09:09:24,374 INFO SettingsFactory:203 - Query language substitution
s: {no='N', yes='Y'}
[java] 09:09:24,374 INFO SettingsFactory:209 - Second-level cache: enabled
[java] 09:09:24,374 INFO SettingsFactory:213 - Query cache: disabled
[java] 09:09:24,374 INFO SettingsFactory:325 - Cache provider: org.hiberna
te.cache.HashtableCacheProvider
[java] 09:09:24,374 INFO SettingsFactory:228 - Optimize cache for minimal
puts: disabled
[java] 09:09:24,374 INFO SettingsFactory:233 - Cache region prefix: hibern
ate.test
[java] 09:09:24,405 INFO SettingsFactory:237 - Structured second-level cac
he entries: disabled
[java] 09:09:24,437 INFO SettingsFactory:257 - Echoing all SQL to stdout
[java] 09:09:24,452 INFO SettingsFactory:264 - Statistics: disabled
[java] 09:09:24,452 INFO SettingsFactory:268 - Deleted entity synthetic id
entifier rollback: disabled
[java] 09:09:24,452 INFO SettingsFactory:283 - Default entity-mode: POJO
[java] 09:09:24,593 INFO SessionFactoryImpl:155 - building session factory
[java] 09:09:24,938 INFO SessionFactoryObjectFactory:82 - Not binding fact
ory to JNDI, no JNDI name configured
[java] 09:09:24,954 INFO SchemaValidator:99 - Running schema validator
[java] 09:09:24,954 INFO SchemaValidator:107 - fetching database metadata
[java] 09:09:24,954 INFO Configuration:1014 - processing extends queue
[java] 09:09:24,954 INFO Configuration:1018 - processing collection mappin
gs
[java] 09:09:24,954 INFO Configuration:1027 - processing association prope
rty references
[java] 09:09:24,954 INFO Configuration:1049 - processing foreign key const
raints
[java] 09:09:24,985 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState
: S1002
[java] 09:09:24,985 ERROR JDBCExceptionReporter:72 - [Microsoft][ODBC SQL S
erver Driver]Invalid Descriptor Index
[java] 09:09:25,001 ERROR SchemaValidator:129 - Error closing connection
[java] java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid transaction state
[java] Initial SessionFactory creation failed.org.hibernate.exception.Gener
icJDBCException: could not get table metadata: Child
[java] java.lang.ExceptionInInitializerError
[java] at HibernateUtil.<clinit>(Unknown Source)
[java] at PCManager.listEvents(Unknown Source)
[java] at PCManager.main(Unknown Source)
[java] Caused by: org.hibernate.exception.GenericJDBCException: could not g
et table metadata: Child
[java] at org.hibernate.exception.SQLStateConverter.handledNonSpecificE
xception(SQLStateConverter.java:91)
[java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
[java] at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
[java] at sun.jdbc.odbc.JdbcOdbc.SQLDisconnect(JdbcOdbc.java:2988)
[java] at sun.jdbc.odbc.JdbcOdbcDriver.disconnect(JdbcOdbcDriver.java:9
80)
[java] at sun.jdbc.odbc.JdbcOdbcConnection.close(JdbcOdbcConnection.jav
a:739)
[java] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaVal
idator.java:125)
[java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
pl.java:299)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
tion.java:1145)
[java] at HibernateUtil.<clinit>(Unknown Source)
[java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateCon
verter.java:79)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
tionHelper.java:43)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
tionHelper.java:29)
[java] at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(
DatabaseMetadata.java:100)
[java] at org.hibernate.cfg.Configuration.validateSchema(Configuration.
java:946)
[java] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaVal
idator.java:116)
[java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
pl.java:299)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
tion.java:1145)
[java] ... 3 more
[java] Caused by: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver
]Invalid Descriptor Index
[java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
[java] at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
[java] at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3862)
[java] at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultS
et.java:5561)
[java] at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.j
ava:338)
[java] at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.j
ava:395)
[java] at PCManager.listEvents(Unknown Source)
[java] at PCManager.main(Unknown Source)
[java] at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata
.java:30)
[java] at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(
DatabaseMetadata.java:85)
[java] ... 7 more
[java] Exception in thread "main"
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 4 seconds
Name and version of the database you are using:
Microsoft SQLServer2000
The generated SQL (show_sql=true):
When the program is run with "hbm2ddl.auto" property as create, I get the following output.
C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc2\MyHibernate>ant run -Daction=store
Buildfile: build.xml
clean:
[delete] Deleting directory C:\Documents and Settings\mirza\Desktop\hibernate
-3.1rc2\MyHibernate\bin
[mkdir] Created dir: C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc
2\MyHibernate\bin
copy-resources:
[copy] Copying 4 files to C:\Documents and Settings\mirza\Desktop\hibernate
-3.1rc2\MyHibernate\bin
compile:
[javac] Compiling 5 source files to C:\Documents and Settings\mirza\Desktop\
hibernate-3.1rc2\MyHibernate\bin
run:
[java] 09:12:54,820 INFO Environment:474 - Hibernate 3.1 rc2
[java] 09:12:54,836 INFO Environment:489 - loaded properties from resource
hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate
.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dial
ect=org.hibernate.dialect.SQLServerDialect, hibernate.max_fetch_depth=1, hiberna
te.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.
substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.cac
he.region_prefix=hibernate.test, hibernate.jdbc.batch_versioned_data=true, hiber
nate.connection.pool_size=1}
[java] 09:12:54,852 INFO Environment:519 - using java.io streams to persis
t binary types
[java] 09:12:54,852 INFO Environment:520 - using CGLIB reflection optimize
r
[java] 09:12:54,867 INFO Environment:550 - using JDK 1.4 java.sql.Timestam
p handling
[java] 09:12:54,946 INFO Configuration:1257 - configuring from resource: /
hibernate.cfg.xml
[java] 09:12:54,946 INFO Configuration:1234 - Configuration resource: /hib
ernate.cfg.xml
[java] 09:12:55,259 INFO Configuration:460 - Reading mappings from resourc
e: PCMapping.hbm.xml
[java] 09:12:55,400 INFO HbmBinder:266 - Mapping class: Parent -> Parent
[java] 09:12:55,447 INFO HbmBinder:266 - Mapping class: Child -> Child
[java] 09:12:55,447 INFO Configuration:1368 - Configured SessionFactory: n
ull
[java] 09:12:55,447 INFO Configuration:1014 - processing extends queue
[java] 09:12:55,447 INFO Configuration:1018 - processing collection mappin
gs
[java] 09:12:55,447 INFO HbmBinder:2233 - Mapping collection: Parent.child
ren -> Child
[java] 09:12:55,463 INFO Configuration:1027 - processing association prope
rty references
[java] 09:12:55,479 INFO Configuration:1049 - processing foreign key const
raints
[java] 09:12:55,557 INFO DriverManagerConnectionProvider:41 - Using Hibern
ate built-in connection pool (not for production use!)
[java] 09:12:55,557 INFO DriverManagerConnectionProvider:42 - Hibernate co
nnection pool size: 1
[java] 09:12:55,557 INFO DriverManagerConnectionProvider:45 - autocommit m
ode: false
[java] 09:12:55,573 INFO DriverManagerConnectionProvider:80 - using driver
: sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:MySQL
[java] 09:12:55,573 INFO DriverManagerConnectionProvider:86 - connection p
roperties: {}
[java] 09:12:55,651 INFO SettingsFactory:77 - RDBMS: Microsoft SQL Server,
version: 08.00.0194
[java] 09:12:55,667 INFO SettingsFactory:78 - JDBC driver: JDBC-ODBC Bridg
e (SQLSRV32.DLL), version: 2.0001 (03.85.1117)
[java] 09:12:55,682 INFO Dialect:100 - Using dialect: org.hibernate.dialec
t.SQLServerDialect
[java] 09:12:55,698 INFO TransactionFactoryFactory:31 - Using default tran
saction strategy (direct JDBC transactions)
[java] 09:12:55,714 INFO TransactionManagerLookupFactory:33 - No Transacti
onManagerLookup configured (in JTA environment, use of read-write or transaction
al second-level cache is not recommended)
[java] 09:12:55,714 INFO SettingsFactory:125 - Automatic flush during befo
reCompletion(): disabled
[java] 09:12:55,714 INFO SettingsFactory:129 - Automatic session close at
end of transaction: disabled
[java] 09:12:55,729 INFO SettingsFactory:144 - Scrollable result sets: ena
bled
[java] 09:12:55,729 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
isabled
[java] 09:12:55,745 INFO SettingsFactory:160 - Connection release mode: au
to
[java] 09:12:55,745 INFO SettingsFactory:184 - Maximum outer join fetch de
pth: 1
[java] 09:12:55,745 INFO SettingsFactory:187 - Default batch fetch size: 1
[java] 09:12:55,745 INFO SettingsFactory:191 - Generate SQL with comments:
disabled
[java] 09:12:55,745 INFO SettingsFactory:195 - Order SQL updates by primar
y key: disabled
[java] 09:12:55,745 INFO SettingsFactory:338 - Query translator: org.hiber
nate.hql.ast.ASTQueryTranslatorFactory
[java] 09:12:55,777 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTran
slatorFactory
[java] 09:12:55,792 INFO SettingsFactory:203 - Query language substitution
s: {no='N', yes='Y'}
[java] 09:12:55,792 INFO SettingsFactory:209 - Second-level cache: enabled
[java] 09:12:55,792 INFO SettingsFactory:213 - Query cache: disabled
[java] 09:12:55,792 INFO SettingsFactory:325 - Cache provider: org.hiberna
te.cache.HashtableCacheProvider
[java] 09:12:55,808 INFO SettingsFactory:228 - Optimize cache for minimal
puts: disabled
[java] 09:12:55,808 INFO SettingsFactory:233 - Cache region prefix: hibern
ate.test
[java] 09:12:55,808 INFO SettingsFactory:237 - Structured second-level cac
he entries: disabled
[java] 09:12:55,839 INFO SettingsFactory:257 - Echoing all SQL to stdout
[java] 09:12:55,839 INFO SettingsFactory:264 - Statistics: disabled
[java] 09:12:55,839 INFO SettingsFactory:268 - Deleted entity synthetic id
entifier rollback: disabled
[java] 09:12:55,839 INFO SettingsFactory:283 - Default entity-mode: POJO
[java] 09:12:55,980 INFO SessionFactoryImpl:155 - building session factory
[java] 09:12:56,325 INFO SessionFactoryObjectFactory:82 - Not binding fact
ory to JNDI, no JNDI name configured
[java] 09:12:56,341 INFO Configuration:1014 - processing extends queue
[java] 09:12:56,341 INFO Configuration:1018 - processing collection mappin
gs
[java] 09:12:56,341 INFO Configuration:1027 - processing association prope
rty references
[java] 09:12:56,341 INFO Configuration:1049 - processing foreign key const
raints
[java] 09:12:56,356 INFO Configuration:1014 - processing extends queue
[java] 09:12:56,356 INFO Configuration:1018 - processing collection mappin
gs
[java] 09:12:56,356 INFO Configuration:1027 - processing association prope
rty references
[java] 09:12:56,372 INFO Configuration:1049 - processing foreign key const
raints
[java] 09:12:56,372 INFO SchemaExport:153 - Running hbm2ddl schema export
[java] 09:12:56,388 DEBUG SchemaExport:171 - import file not found: /import
.sql
[java] 09:12:56,388 INFO SchemaExport:180 - exporting generated schema to
database
[java] 09:12:56,403 DEBUG SchemaExport:283 -
[java] alter table Child
[java] drop constraint FK3E104FC976A59A
[java] 09:12:56,466 DEBUG SchemaExport:283 -
[java] drop table Child
[java] 09:12:56,544 DEBUG SchemaExport:283 -
[java] drop table Parent
[java] 09:12:56,654 DEBUG SchemaExport:283 -
[java] create table Child (
[java] id numeric(19,0) identity not null,
[java] name varchar(255) null,
[java] parent_id numeric(19,0) null,
[java] primary key (id)
[java] )
[java] 09:12:56,779 DEBUG SchemaExport:283 -
[java] create table Parent (
[java] id numeric(19,0) identity not null,
[java] primary key (id)
[java] )
[java] 09:12:56,873 DEBUG SchemaExport:283 -
[java] alter table Child
[java] add constraint FK3E104FC976A59A
[java] foreign key (parent_id)
[java] references Parent
[java] 09:12:56,952 INFO SchemaExport:200 - schema export complete
[java] 09:12:56,952 WARN JDBCExceptionReporter:48 - SQL Warning: 5701, SQL
State: 01000
[java] 09:12:56,952 WARN JDBCExceptionReporter:49 - [Microsoft][ODBC SQL S
erver Driver][SQL Server]Changed database context to 'master'.
[java] 09:12:56,952 WARN JDBCExceptionReporter:48 - SQL Warning: 5703, SQL
State: 01000
[java] 09:12:56,952 WARN JDBCExceptionReporter:49 - [Microsoft][ODBC SQL S
erver Driver][SQL Server]Changed language setting to us_english.
[java] 09:12:56,983 INFO SessionFactoryImpl:432 - Checking 0 named queries
[java] Hibernate:
[java] insert
[java] into
[java] Child
[java] (name)
[java] values
[java] (?) select
[java] scope_identity()
[java] Hibernate:
[java] insert
[java] into
[java] Child
[java] (name)
[java] values
[java] (?) select
[java] scope_identity()
[java] Hibernate:
[java] insert
[java] into
[java] Child
[java] (name)
[java] values
[java] (?) select
[java] scope_identity()
[java] Hibernate:
[java] insert
[java] into
[java] Parent
[java] default
[java] values
[java] select
[java] scope_identity()
[java] Hibernate:
[java] update
[java] Child
[java] set
[java] parent_id=?
[java] where
[java] id=?
[java] Hibernate:
[java] update
[java] Child
[java] set
[java] parent_id=?
[java] where
[java] id=?
[java] Hibernate:
[java] update
[java] Child
[java] set
[java] parent_id=?
[java] where
[java] id=?
[java] 09:12:57,390 INFO SessionFactoryImpl:831 - closing
[java] 09:12:57,390 INFO DriverManagerConnectionProvider:147 - cleaning up
connection pool: jdbc:odbc:MySQL
BUILD SUCCESSFUL
Total time: 5 seconds
Debug level Hibernate log excerpt:
Included in the above description.That's not the right mapping for the 1:m relationship in Hibernate.
First of all, I believe the recommendation is to have a separate .hbm.xml file for each class, so you should have one for Parent and Child.
Second, you'll find the proper syntax for a one-to-many relationship here:
http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html#tutorial-associations
See if those help.
The tutorial docs for Hibernate are quite good. I'd recommend going through them carefully.
% -
Having trouble with the following poblem.. specially how to code getChildren??????? Help urgent
Create a class called Families which creates a one-to-many mapping of parent name (String) to Child objects. Create any needed member variables and write the two specified methods. (You do not need to write the Child class.)
class Families {
public void addToFamily( String parent, Child child) {
public List getChildren( String parent) {
I have done the following..
import java.util.ArrayList;
import java.util.List;
class Families {
private String parentName;
List <child> children = new ArrayList();
public Families(String name){
this.parentName = name;
public void addToFamily( String parent, child kid) {
Families f = new Families(parent);
f.children.add(kid);
public List<child> getChildren( String parent) {
return this.children;
}Having trouble with the following poblem.. specially
how to code getChildren??????? Help urgent
Create a class called Families which creates a
one-to-many mapping of parent name (String) to Child
objects. Create any needed member variables and write
the two specified methods. This key:
(You do not need to write the Child class.)How can the following line possibly work?
List <child> children = new ArrayList();It's not syntactically correct, AND you're not writing the Child class.
% -
How can I make more than one account with chat on clubwpt?
I can't make more than one account with chat on clubwpt? i know several players that has made as many as 20 accounts with chat.I can make accounts but clubwpt will not give me chat,they must have my IP address ,because their response is " you r allowed one account with chat only." But as I have said several players have several accounts with chat. Can anyone help me? Are there any programs or plugins that can do this?Any help at all will be greatly appreciate.
Open another iCloud account for the other user.
-
One to Many with multiple tables on One side and one table on Many side
Sorry for the confusion in the title. Here is my question. In my program, I have 2 different tables which store 2 different type of entities. Each one of entities has a list of attachments which I stored in a common attachment table. There is a one-to-many relationship between entity tables and attachment table.
ENTITY_ONE (
ID
NAME
ENTITY_TWO (
ID
NAME
ATTACHMENTS (
ID
ENTITY_ID
ATTACHMENT_NAME
ENTITY_ID in ATTACHMENTS table is used to link attachments to either entity one or entity two. All IDs are generated by one sequence. So they are always unique. My question is how I could map this relationship into EntityOne, EntityTwo and Attachment JAVA class?For EntityOne and EntityTwo you can just define a normal OneToMany mapping using the foreign key.
Are you using JPA, or the TopLink API? JPA requires a mappedBy for the OneToMany, so this may be more difficult. You should be able to just add a JoinColumn on the OneToMany and make the column insertable/updateable=false.
For the attachment, you could either map the foreign key as a Basic (DirectToFieldMapping) and maintain it in your model, or use a VariableOneToOne mapping in TopLink (this will require the entities share a common interface).
James : http://www.eclipselink.org : http://en.wikibooks.org/wiki/Java_Persistence -
Hi,
I have a PC class that represents a TreeNode object (a GcGroup), which
has a one-to-many relationship with itself to keep track of its descendants.
For example a hierarchy of A -> B -> C, where A has B,C as descendants
and B has C as a descendant. This is tracked by adding or removing a
descendant with a recursive method to update a TreeNode's parent's
descendants when a child is added or removed.
The odd behaviour happens when I delete a child and try to remove the
child manually from all my parent's descendant relations when I use a
HashSet (possibly happens with any Set). In this case kodo will remove
the relations with the following SQL statement:
DELETE FROM TREENODE_DESCENDANTSX JDOIDX = xxxx;
So when I do my recursive call I get a JDOException thrown stating that
the object xxxx has already been deleted.
When I change the relationship to an ArrayList this exception is not
thrown and I do not get the error.
Looking at the SQL generated they look the same:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
27106317
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
28819334
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
10817575
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:21
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
UPDATE GCGroup SET JDOLOCKX=8, child_count=0 WHERE (id = 81 AND JDOLOCKX
= 7)
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
27106317
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
8331873
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
10817575
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:21
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
DELETE FROM GROUP__DESCENDANTSX WHERE JDOIDX = 12300
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
27106317
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
8331873
2002-10-31 20:21:42,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
10817575
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:21
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
DELETE FROM GROUP__USERSX WHERE group_id = 12300
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
27106317
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
8331873
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
10817575
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:21
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
DELETE FROM GCGroup WHERE id = 12300
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
27106317
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
10817575
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:21
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:21:42,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
commit data store transaction
My methods look like the following:
public void removeChild(TreeNode t) {
_children.remove(t);
removeDescendant(t);
protected void removeDescendant(TreeNode t) {
if (_parent != null) {
_parent.removeDescendant(t);
_descendants.remove(t);
The following is the stack trace from the exception when using a HashSet:
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
30836962
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
UPDATE GCGroup SET JDOLOCKX=3, child_count=0 WHERE (id = 12450 AND
JDOLOCKX = 2)
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
28630940
2002-10-31 20:54:10,046 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
UPDATE GCGroup SET JDOLOCKX=41 WHERE (id = 2 AND JDOLOCKX = 40)
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29663640
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,062 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
DELETE FROM GROUP__DESCENDANTSX WHERE JDOIDX = 12451
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29663640
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
DELETE FROM GROUP__USERSX WHERE group_id = 12451
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29663640
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,078 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
DELETE FROM GCGroup WHERE id = 12451
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
5057297
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
DELETE FROM GROUP__DESCENDANTSX WHERE JDOIDX = 12452
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
5057297
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
DELETE FROM GROUP__USERSX WHERE group_id = 12452
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
5057297
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,093 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
DELETE FROM GCGroup WHERE id = 12452
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
roll back data store transaction
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
4629956
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,109 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
SELECT t0.id, t0.JDOLOCKX, t0.child_count, t0.description,
t0.global_read, t0.global_write, t0.name, t0.owner_id, t0.parent_id,
t0.rank, t0.root_id, t0.user_count, t0.user_exists, t0.visibility FROM
GCGroup t0 WHERE t0.id = 12451
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] [ C:
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
18799851
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; S:
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
2951648
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; T:
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
29139395
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ; D:
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
02/10/31 20:54
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo] ]
2002-10-31 20:54:10,125 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnectionFactoryImpl.kodo]
SELECT t0.id, t0.JDOLOCKX, t0.child_count, t0.description,
t0.global_read, t0.global_write, t0.name, t0.owner_id, t0.parent_id,
t0.rank, t0.root_id, t0.user_count, t0.user_exists, t0.visibility FROM
GCGroup t0 WHERE t0.id = 12452
2002-10-31 20:54:10,140 INFO [STDOUT]
com.gulfnet.common.actions.GroupAction : The exception is:
javax.jdo.JDOException
2002-10-31 20:54:10,140 INFO [org.jboss.web.localhost.Engine] action:
com.gulfnet.common.actions.GroupAction : The exception is:
javax.jdo.JDOException
2002-10-31 20:54:10,140 INFO [STDOUT]
com.gulfnet.common.actions.GroupAction : java.lang.NullPointerException
2002-10-31 20:54:10,140 INFO [org.jboss.web.localhost.Engine] action:
com.gulfnet.common.actions.GroupAction : java.lang.NullPointerException
2002-10-31 20:54:10,140 ERROR [STDERR] javax.jdo.JDOException:
java.lang.NullPointerException
NestedThrowables:
java.lang.NullPointerException
2002-10-31 20:54:10,156 ERROR [STDERR] at
com.solarmetric.kodo.ee.EEPersistenceManager.rollback(EEPersistenceManager.java:169)
2002-10-31 20:54:10,156 ERROR [STDERR] at
com.gulfnet.usermanager.UserManager.deleteGroup(UserManager.java:775)
2002-10-31 20:54:10,156 ERROR [STDERR] at
com.gulfnet.common.actions.GroupAction.deleteObject(GroupAction.java:146)
2002-10-31 20:54:10,171 ERROR [STDERR] at
com.gulfnet.common.actions.GroupAction.doAction(GroupAction.java:58)
KamForgot to add that I am using SQLServer 2000, Jboss 3.0.3 and Kodo 2.3.4
Kam -
One-to-many relation sometimes INSERTs child before parent
Hi,
I have a one-to-many relationship, say Company-Employee, that I want to be
managed by the parent entity (Company), so that when I make persistent the
Company, its Employees are also made persistent, and when I delete the
Company, its Employees are deleted. In my Java code, Company has an
ArrayList of Employees, and Employee has a Company member variable.
My metadata looks like this:
<class name="Company" identity-type="application">...
<field name="employees">
<collection element-type="Employee"/>
<extension vendor-name="kodo" key="inverse-owner" value="company"/>
<!-- delete all Employees when the Company is deleted -->
<extension vendor-name="kodo" key="element-dependent" value="true"/>
</field>
</class>
<class name="Employee" identity-type="application">...
<field name="company"/>
</class>
I have a test that is creating a Company with an Employee and persisting
it. It then deletes the Company. The test is passing some of the time and
failing some of the time. It seems to not be consistent with the ordering
of the INSERTs - sometimes it inserts Company then Employee, but sometimes
it first tries to insert into Employee, which fails with a foreign key
constraint to the parent table.
How can I force it to insert into the parent table first?
I notice that the documentation says you need the field of the child
entity to be the inverse-owner. Is it not possible for the parent entity
to own the relationship?
Many thanks,
AlexAlex,
If you have non-deferred foreign keys between the tables, and you turn
on Kodo's foreign key reordering algorithm, Kodo will ensure that all
your foreign key constraints are met, regardless of the ordering of the
operations in your Java code.
See http://docs.solarmetric.com/ref_guide_dbsetup_fks.html for details
about this.
Regarding inverse-owner specification -- is there any reason why you
want to specify this on the other side? inverse-owner basically defines
which side of a shared relationship defines the mappings and should be
monitored for changes; it does not have any impact on the mappings
themselves.
-Patrick
Alex Robbins wrote:
Hi,
I have a one-to-many relationship, say Company-Employee, that I want to be
managed by the parent entity (Company), so that when I make persistent the
Company, its Employees are also made persistent, and when I delete the
Company, its Employees are deleted. In my Java code, Company has an
ArrayList of Employees, and Employee has a Company member variable.
My metadata looks like this:
<class name="Company" identity-type="application">...
<field name="employees">
<collection element-type="Employee"/>
<extension vendor-name="kodo" key="inverse-owner" value="company"/>
<!-- delete all Employees when the Company is deleted -->
<extension vendor-name="kodo" key="element-dependent" value="true"/>
</field>
</class>
<class name="Employee" identity-type="application">...
<field name="company"/>
</class>
I have a test that is creating a Company with an Employee and persisting
it. It then deletes the Company. The test is passing some of the time and
failing some of the time. It seems to not be consistent with the ordering
of the INSERTs - sometimes it inserts Company then Employee, but sometimes
it first tries to insert into Employee, which fails with a foreign key
constraint to the parent table.
How can I force it to insert into the parent table first?
I notice that the documentation says you need the field of the child
entity to be the inverse-owner. Is it not possible for the parent entity
to own the relationship?
Many thanks,
Alex -
One-to-many/foreign keys howto
I have a situation where I'm trying to assemble a web of data and not make
JDO mad.
Here's the structure. I load this data in in batches, with an entry being
placed in a load history table (H) to track each batch. Each batch
contains primary (M) records associated with 0..n qualifying records from
one or both of two auxiliary tables (D, L). All liberally salted with
primary and foreign keys for referential integrity, and most of the keys
are compounds, since the "M" identifiers get recycled for each batch load.
Or, in other words, the "M" key is an ID plus an H key.
Here's a map:
H--0..n-->M
__ +--0..n-->D
__ +--0..n-->L
Just to make things even more fun, the primary key of the H table is an
Oracle 8 "DATE" type, which -- unlike ANSI SQL -- is actually a
"TIMESTAMP". Kodo is rendering this as a java.util.Date rather than
java.sql.Date, which is fine, because I need the full millisecond
resolution. Interestingly, when I altered the schema type to "timestamp",
load operations failed because the "column value was too big" according to
Oracle.
Also adding to the enjoyment, the actual order of presentation of data is
that ALL M records come in, then ALL D records and finally ALL L records.
I create my own H when the load starts.
Now ideally, the whole shooting match will be a single pass/fail
transaction, but that's for later.
Right now, I can create the H, no problem and M's no problem. However,
adding the D's and L's fails come commit time:
kodo.util.FatalUserException: Attempt to set column "OFAC_ADDRESS.LOAD_ID"
to two different values: "7/9/04 9:41 AM", "7/9/04 9:41 AM" This can occur
when you fail to set both sides of a two-sided relation between objects,
or when you map different fields to the same column, but you do not keep
the values of these fields in synch.
The granularity of the timestamps printed isn't making life easier, so I
double-checked the D record's actual local value
ADDRESS SERIALIZER A: Fri Jul 09 09:41:58 EDT 2004/Fri Jul 09 09:41:58 EDT
2004
ADDRESS SERIALIZER B: 1089380518179/1089380518179 (getTime())
ADDRESS SERIALIZER C: -1541174818/-1541174818 (hashCode())
I think I need a clearer understanding of what actions cascade here and
what actions require manual help. For M, I did a setH(H) plus a
setHid(H.getId()) and that made it happy. For D's and L's, of course, I
also have to do a setM(M), where, because of the way the data comes in, I
had to lookup the previously-stored M based on the M.id plus H.id.
Now the parent objects contain sets of child objects. In theory, I should
be adding the newly-created children to those sets, but in practice,
setting the parent on the child appears to cause this to happen
automagically, though I still have to manually set the local value of the
foreign key field.
I really need to find a good FM to RT. Online (and in the Kodo docs), I
find a lot about setting up the XML for one-to-many mapping, but the Java
coding side is taken as obvious. Regrettably, few things are obvious to me.
I suppose I should excerpt the schema just for completeness:
<table name="LOAD_HISTORY">
<pk name="SYS_C0036906" column="LOAD_ID"/>
<column name="LIST_TYPE" type="varchar" size="32"/>
<column name="LOADED_BY" type="varchar" size="32"/>
<column name="LOAD_ID" type="date" not-null="true" size="7"/>
<column name="SUNSET_TIME" type="date" size="7"/>
<fk name="FK_LOADHISTORY_LOADEDBY" delete-action="exception"
to-table="OFAC.OFAC_USERS" column="LOADED_BY"/>
</table>
<table name="OFAC_ADDRESS">
<pk name="SYS_C0036904">
<on column="ADDRESS_ID"/>
<on column="LOAD_ID"/>
</pk>
<column name="ADDRESS" type="varchar" size="125"/>
<column name="ADDRESS_ID" type="decimal" not-null="true"
size="22"/>
<column name="CITY" type="varchar" size="64"/>
<column name="COUNTRY" type="varchar" size="64"/>
<column name="ID" type="decimal" size="22"/>
<column name="LOAD_ID" type="date" not-null="true" size="7"/>
<column name="REMARKS" type="varchar" size="300"/>
<fk name="FK_OFACADDRESS_ID" delete-action="exception"
to-table="OFAC.OFAC_MAIN">
<join column="ID" to-column="ID"/>
<join column="LOAD_ID" to-column="LOAD_ID"/>
</fk>
<fk name="FK_OFACADDRESS_LOADID" delete-action="exception"
to-table="OFAC.LOAD_HISTORY" column="LOAD_ID"/>
</table>
<table name="OFAC_ALIAS">
<pk name="SYS_C0036905">
<on column="ALIAS_ID"/>
<on column="LOAD_ID"/>
</pk>
<column name="ALIAS" type="varchar" size="200"/>
<column name="ALIAS_ID" type="decimal" not-null="true"
size="22"/>
<column name="ID" type="decimal" size="22"/>
<column name="LOAD_ID" type="date" not-null="true" size="7"/>
<column name="REMARKS" type="varchar" size="300"/>
<fk name="FK_OFACALIAS_ID" delete-action="exception"
to-table="OFAC.OFAC_MAIN">
<join column="ID" to-column="ID"/>
<join column="LOAD_ID" to-column="LOAD_ID"/>
</fk>
<fk name="FK_OFACALIAS_LOADID" delete-action="exception"
to-table="OFAC.LOAD_HISTORY" column="LOAD_ID"/>
</table>
<table name="OFAC_MAIN">
<pk name="SYS_C0036903">
<on column="ID"/>
<on column="LOAD_ID"/>
</pk>
<column name="ID" type="decimal" not-null="true" size="22"/>
<column name="LOAD_ID" type="date" not-null="true" size="7"/>
<column name="REMARKS" type="varchar" size="300"/>
<fk name="FK_OFACMAIN_LOADID" delete-action="exception"
to-table="OFAC.LOAD_HISTORY" column="LOAD_ID"/>
</table>Hi Greg,
I'm just using the unmodified schema-to-mapping output. The one thing that
might be unusual is that I've broken up related tables into discrete
packages, but I believe all the items in question are in this package.
Here it is:
<?xml version="1.0" encoding="UTF-8"?>
<mapping>
<package name="com.everbank.finance.ofac3.jdo.sdn">
<class name="LoadHistory">
<jdbc-class-map type="base" table="OFAC.LOAD_HISTORY"/>
<jdbc-version-ind type="state-image"/>
<field name="listType">
<jdbc-field-map type="value" column="LIST_TYPE"/>
</field>
<field name="loadId">
<jdbc-field-map type="value" column="LOAD_ID"/>
</field>
<field name="ofacAddress">
<jdbc-field-map type="one-many"
ref-column.LOAD_ID="LOAD_ID" table="OFAC.OFAC_ADDRESS"/>
</field>
<field name="ofacAlias">
<jdbc-field-map type="one-many"
ref-column.LOAD_ID="LOAD_ID" table="OFAC.OFAC_ALIAS"/>
</field>
<field name="ofacMains">
<jdbc-field-map type="one-many"
ref-column.LOAD_ID="LOAD_ID" table="OFAC.OFAC_MAIN"/>
</field>
<field name="ofacUsers">
<jdbc-field-map type="one-one" column.USER_ID="LOADED_BY"/>
</field>
<field name="runInfoLoadIdents">
<jdbc-field-map type="one-many"
ref-column.LOAD_ID="LOAD_ID" table="OFAC.RUN_INFO_LOAD_ID"/>
</field>
<field name="sunsetTime">
<jdbc-field-map type="value" column="SUNSET_TIME"/>
</field>
</class>
<class name="OfacAddress">
<jdbc-class-map type="base" table="OFAC.OFAC_ADDRESS"/>
<jdbc-version-ind type="state-image"/>
<field name="address">
<jdbc-field-map type="value" column="ADDRESS"/>
</field>
<field name="addressId">
<jdbc-field-map type="value" column="ADDRESS_ID"/>
</field>
<field name="addressMp1">
<jdbc-field-map type="value" column="ADDRESS_MP1"/>
</field>
<field name="addressMp2">
<jdbc-field-map type="value" column="ADDRESS_MP2"/>
</field>
<field name="city">
<jdbc-field-map type="value" column="CITY"/>
</field>
<field name="cityMp1">
<jdbc-field-map type="value" column="CITY_MP1"/>
</field>
<field name="cityMp2">
<jdbc-field-map type="value" column="CITY_MP2"/>
</field>
<field name="country">
<jdbc-field-map type="value" column="COUNTRY"/>
</field>
<field name="countryMp1">
<jdbc-field-map type="value" column="COUNTRY_MP1"/>
</field>
<field name="countryMp2">
<jdbc-field-map type="value" column="COUNTRY_MP2"/>
</field>
<field name="loadHistory">
<jdbc-field-map type="one-one" column.LOAD_ID="LOAD_ID"/>
</field>
<field name="loadId">
<jdbc-field-map type="value" column="LOAD_ID"/>
</field>
<field name="ofacMain">
<jdbc-field-map type="one-one" column.ID="ID"
column.LOAD_ID="LOAD_ID"/>
</field>
<field name="remarks">
<jdbc-field-map type="value" column="REMARKS"/>
</field>
</class>
<class name="OfacAlias">
<jdbc-class-map type="base" table="OFAC.OFAC_ALIAS"/>
<jdbc-version-ind type="state-image"/>
<field name="alias">
<jdbc-field-map type="value" column="ALIAS"/>
</field>
<field name="aliasId">
<jdbc-field-map type="value" column="ALIAS_ID"/>
</field>
<field name="aliasMp1">
<jdbc-field-map type="value" column="ALIAS_MP1"/>
</field>
<field name="aliasMp2">
<jdbc-field-map type="value" column="ALIAS_MP2"/>
</field>
<field name="aliasType">
<jdbc-field-map type="value" column="ALIAS_TYPE"/>
</field>
<field name="loadHistory">
<jdbc-field-map type="one-one" column.LOAD_ID="LOAD_ID"/>
</field>
<field name="loadId">
<jdbc-field-map type="value" column="LOAD_ID"/>
</field>
<field name="ofacMain">
<jdbc-field-map type="one-one" column.ID="ID"
column.LOAD_ID="LOAD_ID"/>
</field>
<field name="remarks">
<jdbc-field-map type="value" column="REMARKS"/>
</field>
</class>
<class name="OfacMain">
<jdbc-class-map type="base" table="OFAC.OFAC_MAIN"/>
<jdbc-version-ind type="state-image"/>
<field name="callSign">
<jdbc-field-map type="value" column="CALL_SIGN"/>
</field>
<field name="callSignMp1">
<jdbc-field-map type="value" column="CALL_SIGN_MP1"/>
</field>
<field name="callSignMp2">
<jdbc-field-map type="value" column="CALL_SIGN_MP2"/>
</field>
<field name="grt">
<jdbc-field-map type="value" column="GRT"/>
</field>
<field name="id">
<jdbc-field-map type="value" column="ID"/>
</field>
<field name="loadHistory">
<jdbc-field-map type="one-one" column.LOAD_ID="LOAD_ID"/>
</field>
<field name="loadId">
<jdbc-field-map type="value" column="LOAD_ID"/>
</field>
<field name="matchInfos">
<jdbc-field-map type="one-many" ref-column.ID="ID"
ref-column.LOAD_ID="LOAD_ID" table="OFAC.MATCH_INFO"/>
</field>
<field name="ofacAddress">
<jdbc-field-map type="one-many" ref-column.ID="ID"
ref-column.LOAD_ID="LOAD_ID" table="OFAC.OFAC_ADDRESS"/>
</field>
<field name="ofacAlias">
<jdbc-field-map type="one-many" ref-column.ID="ID"
ref-column.LOAD_ID="LOAD_ID" table="OFAC.OFAC_ALIAS"/>
</field>
<field name="pName">
<jdbc-field-map type="value" column="P_NAME"/>
</field>
<field name="pNameMp1">
<jdbc-field-map type="value" column="P_NAME_MP1"/>
</field>
<field name="pNameMp2">
<jdbc-field-map type="value" column="P_NAME_MP2"/>
</field>
<field name="program">
<jdbc-field-map type="value" column="PROGRAM"/>
</field>
<field name="remarks">
<jdbc-field-map type="value" column="REMARKS"/>
</field>
<field name="sName">
<jdbc-field-map type="value" column="S_NAME"/>
</field>
<field name="sNameMp1">
<jdbc-field-map type="value" column="S_NAME_MP1"/>
</field>
<field name="sNameMp2">
<jdbc-field-map type="value" column="S_NAME_MP2"/>
</field>
<field name="sdnType">
<jdbc-field-map type="value" column="SDN_TYPE"/>
</field>
<field name="ssn">
<jdbc-field-map type="value" column="SSN"/>
</field>
<field name="title">
<jdbc-field-map type="value" column="TITLE"/>
</field>
<field name="tonnage">
<jdbc-field-map type="value" column="TONNAGE"/>
</field>
<field name="vesselFlag">
<jdbc-field-map type="value" column="VESSEL_FLAG"/>
</field>
<field name="vesselOwner">
<jdbc-field-map type="value" column="VESSEL_OWNER"/>
</field>
<field name="vesselOwnerMp1">
<jdbc-field-map type="value" column="VESSEL_OWNER_MP1"/>
</field>
<field name="vesselOwnerMp2">
<jdbc-field-map type="value" column="VESSEL_OWNER_MP2"/>
</field>
<field name="vesselType">
<jdbc-field-map type="value" column="VESSEL_TYPE"/>
</field>
</class>
</package>
</mapping>
Als, just for giggles, the JDO file
<?xml version="1.0" encoding="UTF-8"?>
<jdo>
<package name="com.everbank.finance.ofac3.jdo.sdn">
<class name="LoadHistory"
objectid-class="com.everbank.finance.ofac3.jdo.LoadHistoryId">
<field name="loadId" primary-key="true"/>
<field name="ofacAddress">
<collection element-type="OfacAddress"/>
<extension vendor-name="kodo" key="inverse-owner"
value="loadHistory"/>
</field>
<field name="ofacAlias">
<collection element-type="OfacAlias"/>
<extension vendor-name="kodo" key="inverse-owner"
value="loadHistory"/>
</field>
<field name="ofacMains">
<collection element-type="OfacMain"/>
<extension vendor-name="kodo" key="inverse-owner"
value="loadHistory"/>
</field>
<field name="runInfoLoadIdents">
<collection
element-type="com.everbank.finance.ofac3.jdo.match.RunInfoLoadIdent"/>
<extension vendor-name="kodo" key="inverse-owner"
value="loadHistory"/>
</field>
</class>
<class name="OfacAddress"
objectid-class="com.everbank.finance.ofac3.jdo.OfacAddressId">
<field name="addressId" primary-key="true"/>
<field name="loadId" primary-key="true"/>
</class>
<class name="OfacAlias"
objectid-class="com.everbank.finance.ofac3.jdo.OfacAliasId">
<field name="aliasId" primary-key="true"/>
<field name="loadId" primary-key="true"/>
</class>
<class name="OfacMain"
objectid-class="com.everbank.finance.ofac3.jdo.OfacMainId">
<field name="id" primary-key="true"/>
<field name="loadId" primary-key="true"/>
<field name="matchInfos">
<collection
element-type="com.everbank.finance.ofac3.jdo.match.MatchInfo"/>
<extension vendor-name="kodo" key="inverse-owner"
value="ofacMain"/>
</field>
<field name="ofacAddress">
<collection element-type="OfacAddress"/>
<extension vendor-name="kodo" key="inverse-owner"
value="ofacMain"/>
</field>
<field name="ofacAlias">
<collection element-type="OfacAlias"/>
<extension vendor-name="kodo" key="inverse-owner"
value="ofacMain"/>
</field>
</class>
</package>
Greg Campbell wrote:
Hi Tim,
Could you send the your mapping information corresponding to the class that
maps to table: OFAC_ADDRESS. In particular, I'm looking for what fields
map to OFAC_ADDRESS.LOAD_ID. This will hopefully give us a hint as to
what's going wrong.
Thanks,
Greg
"Tim Holloway" <[email protected]> wrote in message
news:[email protected]...
I have a situation where I'm trying to assemble a web of data and not make
JDO mad.
<snipped> -
Weblogic-cmp-rdbms-jar.xml for One-To-Many unidirectional relationship
hi,
I am trying to create a simple cmp One-To-Many unidirectional relationship and deploy the same in weblogic. Can someone help me with the weblogic-cmp-rdbms-jar.xml. Am attaching the weblogic-cmp-rdbms-jar. xml tht i am using as also the corresponding ejb-jar.xml. Pls. note tht i want a unidirectional relationship here. one i am tryng However i get this error:
Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error was: Role 'Supplier supplies Products' of relationship 'Product Supplier' contains an invalid key-column value of 'productID'. The key-column must specify a primary key column in the related bean. However, there is no primary key column named 'productID' defined in the related bean 'ProductEJB' or else 'productID' is not being recognized due to case mismatch. My weblogic-cmp-rdbms-jar
<?xml version="1.0"?>
<!DOCTYPE weblogic-rdbms-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB RDBMS Persistence//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-rdbms-jar.dtd'>
<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>SupplierEJB</ejb-name>
<data-source-name>RJDataSource</data-source-name>
<table-map>
<table-name>AA_Supplier</table-name>
<field-map>
<cmp-field>supplierID</cmp-field>
<dbms-column>supplierID</dbms-column>
</field-map>
<field-map>
<cmp-field>name</cmp-field>
<dbms-column>name</dbms-column>
</field-map>
</table-map>
</weblogic-rdbms-bean>
<weblogic-rdbms-bean>
<ejb-name>ProductEJB</ejb-name>
<data-source-name>RJDataSource</data-source-name>
<table-map>
<table-name>AA_Product</table-name>
<field-map>
<cmp-field>productID</cmp-field>
<dbms-column>productid</dbms-column>
</field-map>
<field-map>
<cmp-field>description</cmp-field>
<dbms-column>description</dbms-column>
</field-map>
<field-map>
<cmp-field>basePrice</cmp-field>
<dbms-column>baseprice</dbms-column>
</field-map>
<field-map>
<cmp-field>name</cmp-field>
<dbms-column>name</dbms-column>
</field-map>
<field-map>
<cmp-field>supplierID</cmp-field>
<dbms-column>supplierID</dbms-column>
</field-map>
</table-map>
</weblogic-rdbms-bean>
<weblogic-rdbms-relation>
<relation-name>Product Supplier</relation-name>
<weblogic-relationship-role>
<relationship-role-name>Supplier supplies Products</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>supplierID</foreign-key-column>
<key-column>productID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
<weblogic-relationship-role>
<relationship-role-name>Product supplied by Supplier</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>products</foreign-key-column>
<key-column>supplierID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
</weblogic-rdbms-jar> My ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>SupplierEJB</ejb-name>
<home>com.tpt.practice.entityBeans.cmp.product.relationship.SupplierHome</home>
<remote>com.tpt.practice.entityBeans.cmp.product.relationship.Supplier</remote>
<ejb-class>com.tpt.practice.entityBeans.cmp.product.relationship.SupplierEJB</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>AA_Supplier</abstract-schema-name>
<cmp-field>
<field-name>supplierID</field-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
</cmp-field>
<primkey-field>supplierID</primkey-field>
<ejb-ref>
<ejb-ref-name>ProducEJB</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.tpt.practice.entityBeans.cmp.product.ProductHome</home>
<remote>com.tpt.practice.entityBeans.cmp.product.Product</remote>
<ejb-link>ProductEJB#ProductEJB.jar</ejb-link>
</ejb-ref>
<query>
<query-method>
<method-name>findByName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AA_Supplier AS a WHERE a.name =
?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findAllSuppliers</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AA_Supplier AS a WHERE a.supplierID
IS NOT NULL]]>
</ejb-ql>
</query>
</entity>
<entity>
<ejb-name>ProductEJB</ejb-name>
<home>com.tpt.practice.entityBeans.cmp.product.relationship.ProductHome</home>
<remote>com.tpt.practice.entityBeans.cmp.product.relationship.Product</remote>
<local-home>com.tpt.practice.entityBeans.cmp.product.relationship.ProductLocalHome</local-home>
<local>com.tpt.practice.entityBeans.cmp.product.relationship.ProductLocal</local>
<ejb-class>com.tpt.practice.entityBeans.cmp.product.relationship.ProductEJB</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.tpt.practice.entityBeans.cmp.product.relationship.ProductPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>AA_Product</abstract-schema-name>
<cmp-field>
<field-name>productID</field-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
</cmp-field>
<cmp-field>
<field-name>description</field-name>
</cmp-field>
<cmp-field>
<field-name>basePrice</field-name>
</cmp-field>
<cmp-field>
<field-name>supplierID</field-name>
</cmp-field>
<primkey-field>productID</primkey-field>
<query>
<query-method>
<method-name>findByName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.name =
?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findByDescription</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.description
= ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findByBasePrice</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.basePrice =
?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findExpensiveProducts</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.basePrice >
?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findCheapProducts</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.basePrice <
?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findAllProducts</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.productID
IS NOT NULL]]>
</ejb-ql>
</query>
</entity>
</enterprise-beans>
<relationships>
<ejb-relation>
<ejb-relation-name>Product Supplier</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Supplier supplies Products</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>SupplierEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>products</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Product supplied by Supplier</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>ProductEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>SupplierEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>I think u r some confusion with productID and SuppliedID . primary key of one column( productId ) can be a foreign key of other table colum( SuppliedID). but foreign key( SuppliedID) can not be a primary key of second table .u declared SuppliedId as primary key . so ur mapping is incorrect.
-
Problem inserting one-to-many collection
Hi,
I've been trying to get an object (CMDMessage) that has a one-to-many collection (CMDMessageXREF)
inserted into the database, but no matter what I try I can't seem to get the collection to grab the
foreign key value of 'msg_id' to populate that field in the CMDMessageXREF object, I keep getting a nul value.
From reading the forums, it seems the best way to get this value is to setup a back reference one-to-one mapping from the collection to the parent
object, but this doesn't seem to be working from me.
I've attached the pertinent client code as well as the pertinent information from the descriptors and would
appreciate any help on this.
Thanks,
Mark
Client code:
CMDMessage note = new CMDMessage();
note.setAuthorId(new Double(58402));
note.setMsgSubject("Sequence test2");
java.util.ArrayList xrefCollection = new java.util.ArrayList();
CMDMessageXREF xref = new CMDMessageXREF();
xref.setRecipientId(new Double(58400));
xref.setRecipientType("org");
xrefCollection.add(xref);
note.setCmdMessageXrefCollection(xrefCollection);
// runs transaction invoking UnitOfWork to insert objects
TransactionEngine.insert(note);
Descriptors:
public Descriptor buildCMDMessageDescriptor() {
Descriptor descriptor = new Descriptor();
descriptor.setJavaClass(CMDMessage.class);
descriptor.addTableName("CMD_MESSAGE");
descriptor.addPrimaryKeyFieldName("CMD_MESSAGE.MSG_ID");
// Descriptor properties.
descriptor.useNoIdentityMap();
descriptor.setIdentityMapSize(1000);
descriptor.useRemoteNoIdentityMap();
descriptor.setRemoteIdentityMapSize(1000);
descriptor.setSequenceNumberFieldName("CMD_MESSAGE.MSG_ID");
descriptor.setSequenceNumberName("CMD_MSG_ID_SEQUENCE");
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.onlyRefreshCacheIfNewerVersion();
descriptor.setAlias("CMDMessage");
// Query manager.
descriptor.useChangedFieldsLocking();
descriptor.getQueryManager().checkDatabaseForDoesExist();
//Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping msgIdMapping = new DirectToFieldMapping();
msgIdMapping.setAttributeName("msgId");
msgIdMapping.setGetMethodName("getMsgId");
msgIdMapping.setSetMethodName("setMsgId");
msgIdMapping.setFieldName("CMD_MESSAGE.MSG_ID");
descriptor.addMapping(msgIdMapping);
DirectToFieldMapping msgSubjectMapping = new DirectToFieldMapping();
msgSubjectMapping.setAttributeName("msgSubject");
msgSubjectMapping.setGetMethodName("getMsgSubject");
msgSubjectMapping.setSetMethodName("setMsgSubject");
msgSubjectMapping.setFieldName("CMD_MESSAGE.MSG_SUBJECT");
descriptor.addMapping(msgSubjectMapping);
OneToManyMapping cmdMessageXrefCollectionMapping = new OneToManyMapping();
cmdMessageXrefCollectionMapping.setAttributeName("cmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setGetMethodName("getCmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setSetMethodName("setCmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setReferenceClass(CMDMessageXREF.class);
cmdMessageXrefCollectionMapping.useTransparentCollection();
cmdMessageXrefCollectionMapping.useCollectionClass(oracle.toplink.indirection.IndirectList.class);
cmdMessageXrefCollectionMapping.readOnly();
cmdMessageXrefCollectionMapping.addTargetForeignKeyFieldName("CMD_MESSAGE_XREF.MSG_ID", "CMD_MESSAGE.MSG_ID");
descriptor.addMapping(cmdMessageXrefCollectionMapping);
return descriptor;
public Descriptor buildCMDMessageXREFDescriptor() {
Descriptor descriptor = new Descriptor();
descriptor.setJavaClass(CMDMessageXREF.class);
descriptor.addTableName("CMD_MESSAGE_XREF");
descriptor.addPrimaryKeyFieldName("CMD_MESSAGE_XREF.ID");
// Descriptor properties.
descriptor.useNoIdentityMap();
descriptor.setIdentityMapSize(1000);
descriptor.useRemoteNoIdentityMap();
descriptor.setRemoteIdentityMapSize(1000);
descriptor.setSequenceNumberFieldName("CMD_MESSAGE_XREF.ID");
descriptor.setSequenceNumberName("CMD_MSG_XREF_ID_SEQ");
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.onlyRefreshCacheIfNewerVersion();
descriptor.setAlias("CMDMessageXREF");
// Query manager.
descriptor.useChangedFieldsLocking();
descriptor.getQueryManager().checkDatabaseForDoesExist();
//Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setGetMethodName("getId");
idMapping.setSetMethodName("setId");
idMapping.setFieldName("CMD_MESSAGE_XREF.ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping msgIdMapping = new DirectToFieldMapping();
msgIdMapping.setAttributeName("msgId");
msgIdMapping.setGetMethodName("getMsgId");
msgIdMapping.setSetMethodName("setMsgId");
msgIdMapping.setFieldName("CMD_MESSAGE_XREF.MSG_ID");
descriptor.addMapping(msgIdMapping);
DirectToFieldMapping recipientIdMapping = new DirectToFieldMapping();
recipientIdMapping.setAttributeName("recipientId");
recipientIdMapping.setGetMethodName("getRecipientId");
recipientIdMapping.setSetMethodName("setRecipientId");
recipientIdMapping.setFieldName("CMD_MESSAGE_XREF.RECIPIENT_ID");
descriptor.addMapping(recipientIdMapping);
OneToOneMapping cmdMessageInfoMapping = new OneToOneMapping();
cmdMessageInfoMapping.setAttributeName("cmdMessageInfo");
cmdMessageInfoMapping.setGetMethodName("getCmdMessageInfoHolder");
cmdMessageInfoMapping.setSetMethodName("setCmdMessageInfoHolder");
cmdMessageInfoMapping.setReferenceClass(CMDMessage.class);
cmdMessageInfoMapping.useBasicIndirection();
cmdMessageInfoMapping.readOnly();
cmdMessageInfoMapping.addTargetForeignKeyFieldName("CMD_MESSAGE.MSG_ID", "CMD_MESSAGE_XREF.MSG_ID");
descriptor.addMapping(cmdMessageInfoMapping);
return descriptor;
}Chris,
Ok, I've tried both approaches
1. using direct field mapping, getting rid of the one to one mapping on the CMDMessageXREF object, and adding this line xref.setMsgId( note.getMsgId()
and
2. removing the readOnly line for the mappings and setting the CMDMessage in the CMDMessageXREF object as shown below in bold.
but still am getting the same error. Could this be because the MSG_ID field in the database is NOT NULL? Otherwise, I am not seeing what else I can do differently to set this up. Below is the updated relevant code and descriptor showing the second approach I used.
Thanks for the help,
Mark
Client code
CMDMessage note = new CMDMessage();
note.setAuthorId(new Double(58402));
note.setMsgSubject("Sequence test2");
java.util.ArrayList xrefCollection = new java.util.ArrayList();
CMDMessageXREF xref = new CMDMessageXREF();
xref.setRecipientId(new Double(58400));
// added to set value to valueHolder
xref.setCmdMessageInfo(note);
xrefCollection.add(xref);
note.setCmdMessageXrefCollection(xrefCollection);
TransactionEngine.insert(note);
Descriptors
public Descriptor buildCMDMessageDescriptor() {
Descriptor descriptor = new Descriptor();
descriptor.setJavaClass(CMDMessage.class);
descriptor.addTableName("CMD_MESSAGE");
descriptor.addPrimaryKeyFieldName("CMD_MESSAGE.MSG_ID");
// Descriptor properties.
descriptor.useNoIdentityMap();
descriptor.setIdentityMapSize(1000);
descriptor.useRemoteNoIdentityMap();
descriptor.setRemoteIdentityMapSize(1000);
descriptor.setSequenceNumberFieldName("CMD_MESSAGE.MSG_ID");
descriptor.setSequenceNumberName("CMD_MSG_ID_SEQUENCE");
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.onlyRefreshCacheIfNewerVersion();
descriptor.setAlias("CMDMessage");
// Query manager.
descriptor.useChangedFieldsLocking();
descriptor.getQueryManager().checkDatabaseForDoesExist();
//Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping msgIdMapping = new DirectToFieldMapping();
msgIdMapping.setAttributeName("msgId");
msgIdMapping.setGetMethodName("getMsgId");
msgIdMapping.setSetMethodName("setMsgId");
msgIdMapping.setFieldName("CMD_MESSAGE.MSG_ID");
descriptor.addMapping(msgIdMapping);
OneToManyMapping cmdMessageXrefCollectionMapping = new OneToManyMapping();
cmdMessageXrefCollectionMapping.setAttributeName("cmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setGetMethodName("getCmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setSetMethodName("setCmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setReferenceClass(CMDMessageXREF.class);
cmdMessageXrefCollectionMapping.useTransparentCollection();
cmdMessageXrefCollectionMapping.useCollectionClass(oracle.toplink.indirection.IndirectList.class);
cmdMessageXrefCollectionMapping.addTargetForeignKeyFieldName("CMD_MESSAGE_XREF.MSG_ID", "CMD_MESSAGE.MSG_ID");
descriptor.addMapping(cmdMessageXrefCollectionMapping);
return descriptor;
public Descriptor buildCMDMessageXREFDescriptor() {
Descriptor descriptor = new Descriptor();
descriptor.setJavaClass(CMDMessageXREF.class);
descriptor.addTableName("CMD_MESSAGE_XREF");
descriptor.addPrimaryKeyFieldName("CMD_MESSAGE_XREF.ID");
// Descriptor properties.
descriptor.useNoIdentityMap();
descriptor.setIdentityMapSize(1000);
descriptor.useRemoteNoIdentityMap();
descriptor.setRemoteIdentityMapSize(1000);
descriptor.setSequenceNumberFieldName("CMD_MESSAGE_XREF.ID");
descriptor.setSequenceNumberName("CMD_MSG_XREF_ID_SEQ");
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.onlyRefreshCacheIfNewerVersion();
descriptor.setAlias("CMDMessageXREF");
// Query manager.
descriptor.useChangedFieldsLocking();
descriptor.getQueryManager().checkDatabaseForDoesExist();
//Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setGetMethodName("getId");
idMapping.setSetMethodName("setId");
idMapping.setFieldName("CMD_MESSAGE_XREF.ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping recipientIdMapping = new DirectToFieldMapping();
recipientIdMapping.setAttributeName("recipientId");
recipientIdMapping.setGetMethodName("getRecipientId");
recipientIdMapping.setSetMethodName("setRecipientId");
recipientIdMapping.setFieldName("CMD_MESSAGE_XREF.RECIPIENT_ID");
descriptor.addMapping(recipientIdMapping);
OneToOneMapping cmdMessageInfoMapping = new OneToOneMapping();
cmdMessageInfoMapping.setAttributeName("cmdMessageInfo");
cmdMessageInfoMapping.setGetMethodName("getCmdMessageInfoHolder");
cmdMessageInfoMapping.setSetMethodName("setCmdMessageInfoHolder");
cmdMessageInfoMapping.setReferenceClass(CMDMessage.class);
cmdMessageInfoMapping.useBasicIndirection();
cmdMessageInfoMapping.addTargetForeignKeyFieldName("CMD_MESSAGE.MSG_ID", "CMD_MESSAGE_XREF.MSG_ID");
descriptor.addMapping(cmdMessageInfoMapping);
return descriptor;
} -
Aggregate one-to-many relationship problem
Hello,
After migrating from Toplink 9i I've stumbled across a problem with our aggregate objects.
Toplink Workbench reports no errors and generates a nice XML but in runtime I get this error whenever a aggregate function is used.
[TopLink fin]: 2008.02.13 03:18:11.552--ServerSession(12626425)--Connection(29948747)--Thread(Thread[main,5,main])--SELECT DISTINCT t0.NPL_PACK_ID, t0.NPL_ID FROM NPL_MEDPROD t3, FASS_MEDPROD t2, NPL_MEDPROD t1, NPL_PACKAGE t0 WHERE (((t0.NPL_ID = t1._Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test) AND ((t1.NPL_ID = t2.NPL_ID) AND (t3.NPL_ID LIKE '19750613000031%'))) AND (t3.NPL_ID = t2.NPL_ID))
Caused by: Undantag [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.DatabaseException
Internt undantag: java.sql.SQLException: ORA-00911: invalid character
Felkod: 911
I belive that problem resides in this clause :
t1._Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test
I've created a small test project with just a couple of classes but the same aggregate problem occurs which has let me to believe the problem does not come from the migrating process which was my first guess. If anyone could help me discover what I am doing wrong it would be very appreciated. Below is my test project output.
<?xml version="1.0" encoding="UTF-8"?>
<toplink:object-persistence version="Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)" xmlns:opm="http://xmlns.oracle.com/ias/xsds/opm" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:toplink="http://xmlns.oracle.com/ias/xsds/toplink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<opm:name>test</opm:name>
<opm:class-mapping-descriptors>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>se.lif.fass.fassdata.impl.FASSMedProdImpl</opm:class>
<opm:alias>FASSMedProdImpl</opm:alias>
<opm:primary-key>
<opm:field table="FASS_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
</opm:primary-key>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy"/>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:one-to-one-mapping">
<opm:attribute-name>_Medprod</opm:attribute-name>
<opm:reference-class>schemas_npl.instance.impl.MedprodTypeImpl</opm:reference-class>
<opm:private-owned>true</opm:private-owned>
<opm:foreign-key>
<opm:field-reference>
<opm:source-field table="FASS_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
<opm:target-field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
</opm:field-reference>
</opm:foreign-key>
<opm:foreign-key-fields>
<opm:field table="FASS_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
</opm:foreign-key-fields>
<toplink:batch-reading>true</toplink:batch-reading>
<toplink:selection-query xsi:type="toplink:read-object-query"/>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>id</opm:attribute-name>
<opm:read-only>true</opm:read-only>
<opm:field table="FASS_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>independent</toplink:descriptor-type>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
<toplink:tables>
<toplink:table name="FASS_MEDPROD"/>
</toplink:tables>
</opm:class-mapping-descriptor>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>schemas_npl.instance.impl.MedprodTypeImpl</opm:class>
<opm:alias>MedprodTypeImpl</opm:alias>
<opm:primary-key>
<opm:field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
</opm:primary-key>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy"/>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:aggregate-object-mapping">
<opm:attribute-name>_Medprodpack</opm:attribute-name>
<toplink:reference-class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl</toplink:reference-class>
<toplink:allow-null>false</toplink:allow-null>
<toplink:field-translations>
<toplink:field-translation>
<toplink:source-field name="_Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test" xsi:type="opm:column"/>
<toplink:target-field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
</toplink:field-translation>
</toplink:field-translations>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>_Nplid</opm:attribute-name>
<opm:field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>id</opm:attribute-name>
<opm:read-only>true</opm:read-only>
<opm:field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>independent</toplink:descriptor-type>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
<toplink:tables>
<toplink:table name="NPL_MEDPROD"/>
</toplink:tables>
</opm:class-mapping-descriptor>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl</opm:class>
<opm:alias>MedprodTypeImpl$MedprodpackTypeImpl</opm:alias>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy"/>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:one-to-many-mapping">
<opm:attribute-name>_Presentation</opm:attribute-name>
<opm:reference-class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl$PresentationTypeImpl</opm:reference-class>
<opm:private-owned>true</opm:private-owned>
<opm:target-foreign-key>
<opm:field-reference>
<opm:source-field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
<opm:target-field name="_Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test" xsi:type="opm:column"/>
</opm:field-reference>
</opm:target-foreign-key>
<toplink:batch-reading>true</toplink:batch-reading>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>com.sun.xml.bind.util.ListImpl</toplink:collection-type>
</toplink:container>
<toplink:selection-query xsi:type="toplink:read-all-query">
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>com.sun.xml.bind.util.ListImpl</toplink:collection-type>
</toplink:container>
</toplink:selection-query>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>aggregate</toplink:descriptor-type>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
</opm:class-mapping-descriptor>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl$PresentationTypeImpl</opm:class>
<opm:alias>MedprodTypeImpl$MedprodpackTypeImpl$PresentationTypeImpl</opm:alias>
<opm:primary-key>
<opm:field table="NPL_PACKAGE" name="NPL_PACK_ID" xsi:type="opm:column"/>
</opm:primary-key>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy"/>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>_Nplpackid</opm:attribute-name>
<opm:field table="NPL_PACKAGE" name="NPL_PACK_ID" xsi:type="opm:column"/>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:one-to-one-mapping">
<opm:attribute-name>backref</opm:attribute-name>
<opm:reference-class>schemas_npl.instance.impl.MedprodTypeImpl</opm:reference-class>
<opm:foreign-key>
<opm:field-reference>
<opm:source-field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
<opm:target-field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
</opm:field-reference>
</opm:foreign-key>
<opm:foreign-key-fields>
<opm:field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
</opm:foreign-key-fields>
<toplink:indirection xsi:type="toplink:value-holder-indirection-policy"/>
<toplink:selection-query xsi:type="toplink:read-object-query"/>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>id</opm:attribute-name>
<opm:read-only>true</opm:read-only>
<opm:field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>independent</toplink:descriptor-type>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
<toplink:tables>
<toplink:table name="NPL_PACKAGE"/>
</toplink:tables>
</opm:class-mapping-descriptor>
</opm:class-mapping-descriptors>
<toplink:login xsi:type="toplink:database-login">
<toplink:platform-class>oracle.toplink.platform.database.oracle.Oracle8Platform</toplink:platform-class>
<toplink:user-name>fassadmin</toplink:user-name>
<toplink:password>3CC3773C96563CA0C89634305615359CD62D1A19DF561D1E</toplink:password>
<toplink:driver-class>oracle.jdbc.driver.OracleDriver</toplink:driver-class>
<toplink:connection-url>jdbc:oracle:oci8:@DB2</toplink:connection-url>
</toplink:login>
</toplink:object-persistence>
Regards
/JonasThe issue is in the one-to-many mapping in the aggregate,
<br>
<opm:attribute-mapping xsi:type="toplink:one-to-many-mapping">
<opm:attribute-name>_Presentation</opm:attribute-name>
<opm:reference-class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl$PresentationTypeImpl</opm:reference-class>
<opm:private-owned>true</opm:private-owned>
<opm:target-foreign-key>
<opm:field-reference>
<opm:source-field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
<opm:target-field name="_Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test" xsi:type="opm:column"/>
</opm:field-reference>
</opm:target-foreign-key>There is an issue with the Mapping Workbench and shared aggregates with one-to-many mappings and translating the foreign key fields. Did this work before, I would be surprized if it did, unless the 2.5 Builder was used?
Anyway the easiest workaround is to either edit the XML and change the NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test column name to what it should be, or define a descriptor amendment method to define the one-to-many mapping with the correct field names.
-- James : EclipseLink
Maybe you are looking for
-
Hey, I just shot on the DSR-P150. An old camera but I thought it would suffice. Hooked it up to my Graid drive with fire wire cable and FCP is not recognizing it. The AV device warning kept popping up.Tried different options in the Audio Video settin
-
Can we change the login look like we could in 7, 8 ? and are the files the same name / place as 8.x.x ? Thanks George Armstrong Assistant Director of Technology Monroe-Woodbury CSD Harriman, NY 10926 845-460-6600 [email protected] [email protected] h
-
Application Module Configuration Properties file?
Hi, Any body knows where could i find the Application Module Configuration Properties file on the disk. (This properties on wizard are appeared when we right click on application module and select configuration...)
-
How can I extend language support in Portal
Hi everybody, We need extend Vietnamese language suport for Oracle Portal. In others portal (open source ), i can do it by config an properties like : locale.., and provider the resources for our language . In Oracle Portal, i don't hearing anything
-
Problem Sharing Music with my other Computer
Ok, I have two Mac's....a MB Pro, and a Mac Mini. The MM has ALL of my iTunes files stored on it, in it's entirety. I just want to have some random music on my MB Pro. Is there a way I can drag a playlist from my Mac Mini to my MB Pro besides burning