Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

table with multiple primary keys

Hello All, In my MySQL database I have a table with three primary keys. I have to create a space domain class which specifies this table. My problem is with the IDs. What Id and SpaceId I have to annotate in order to be able to write and read these objects from the space and to save it in the database table? I'm using XAP 7.0.

Thanks h4. Attachments

[CurrentData.java|/upfiles/1375970548390405.txt]

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3488]{quote}

asked 2010-08-13 02:05:19 -0500

jeni_m gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2010-08-13 07:19:03 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Hello, I've tried this approach, but when I try to write my object in the space, I receive the following exception:

Exception in thread "main" org.openspaces.core.InternalSpaceException: com.j_spaces.core.sadapter.SAException: org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [71_17_1] [FROM data.CurrentData WHERE id = ?]; nested exception is com.j_spaces.core.exception.internal.EngineInternalSpaceException: com.j_spaces.core.sadapter.SAException: org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [71_17_1] [FROM data.CurrentData WHERE id = ?] at org.openspaces.core.exception.DefaultExceptionTranslator.internalTranslate(DefaultExceptionTranslator.java:97) at org.openspaces.core.exception.DefaultExceptionTranslator.translate(DefaultExceptionTranslator.java:50) at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:629) at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:621) at data.feeder.FeederTest.feedData(FeederTest.java:52) at data.feeder.FeederTest.main(FeederTest.java:28) Caused by: com.j_spaces.core.exception.internal.EngineInternalSpaceException: com.j_spaces.core.sadapter.SAException: org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [71_17_1] [FROM data.CurrentData WHERE id = ?] at com.gigaspaces.internal.server.space.SpaceEngine.write(SpaceEngine.java:951) at com.gigaspaces.internal.server.space.SpaceEngine.unsafeWrite(SpaceEngine.java:866) at com.gigaspaces.internal.server.space.SpaceEngine.write(SpaceEngine.java:849) at com.gigaspaces.internal.server.space.SpaceEngine.updateOrWrite(SpaceEngine.java:2055) at com.gigaspaces.internal.server.space.SpaceEngine.updateOrWrite(SpaceEngine.java:2033) at com.gigaspaces.internal.server.space.SpaceImpl.updateOrWrite(SpaceImpl.java:1771) at com.gigaspaces.internal.server.space.SpaceImpl.update(SpaceImpl.java:1672) at com.gigaspaces.internal.server.space.IRemoteSpaceGigaspacesMethodinternalInvoke9.internalInvoke(Unknown Source) at com.gigaspaces.internal.reflection.fast.AbstractMethod.invoke(AbstractMethod.java:34) at com.gigaspaces.lrmi.LRMIRuntime.invoked(LRMIRuntime.java:372) at com.gigaspaces.lrmi.nio.Pivot.consumeAndHandleRequest(Pivot.java:462) at com.gigaspaces.lrmi.nio.Pivot.handleRequest(Pivot.java:551) at com.gigaspaces.lrmi.nio.Pivot$ChannelEntryTask.run(Pivot.java:161) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: com.j_spaces.core.sadapter.SAException: org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [71_17_1] [FROM data.CurrentData WHERE id = ?] at com.j_spaces.sadapter.datasource.DataAdapter.getEntry(DataAdapter.java:544) at com.j_spaces.core.cache.CacheManager.getEntry(CacheManager.java:1545) at com.j_spaces.core.cache.CacheManager.getEntry(CacheManager.java:1564) at com.j_spaces.core.server.processor.Processor.insertEntryToSpace(Processor.java:298) at com.j_spaces.core.server.processor.Processor.insertToSpaceLoop(Processor.java:263) at com.j_spaces.core.server.processor.Processor.handleDirectWriteSA(Processor.java:186) at com.gigaspaces.internal.server.space.SpaceEngine.write(SpaceEngine.java:941) ... 18 more Caused by: org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [71_17_1] [FROM data.CurrentData WHERE id = ?] at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:319) at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:275) at org.hibernate.impl.QueryImpl.list ...(more)

jeni_m gravatar imagejeni_m ( 2010-08-16 15:17:48 -0500 )edit

Are you running in LRU mode? Does it work with ALL_IN_CACHE mode? How's your hibernate mapping looks like? Something is wrong with the mapping of this spaceId field. Shay h4. Attachments

[CurrentData.java|/upfiles/13759705485523866.txt]

shay hassidim gravatar imageshay hassidim ( 2010-08-16 16:52:52 -0500 )edit

Yes, my space is running in LRU mode.

<bean id="hibernateDataSource" class="org.openspaces.persistency.hibernate.StatelessHibernateExternalDataSource" >="" <property="" name="sessionFactory" ref="sessionFactory"/> </bean> <os-core:space id="space" url="/./${dataGridName}" schema="persistent" external-data-source="hibernateDataSource" lookup-groups="${LOOKUPGROUPS}"> <os-core:lru-cache-policy/> </os-core:space>

<property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop> <prop key="hibernate.cache.use_second_level_cache">false</prop> <prop key="hibernate.cache.use_query_cache">false</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.jdbc.batch_size">1</prop> </props>
</property>

I'm attaching the space entity class. h4. Attachments

[CurrentData.java|/upfiles/13759705485605886.txt]

jeni_m gravatar imagejeni_m ( 2010-08-17 06:34:30 -0500 )edit

I think you have something wrong with your hibernate mapping. I suggest you checking the Hibernate forums/support or GigaSpaces support. Shay

shay hassidim gravatar imageshay hassidim ( 2010-08-26 14:44:08 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2010-08-13 02:05:19 -0500

Seen: 24 times

Last updated: Aug 13 '10