Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO][Teneo] How to write / read LOB data stream based?
Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006937 is a reply to message #1006840] Sun, 03 February 2013 05:15 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.02.2013 19:38, schrieb KW:
> I was able to use the Blob type from the etypes in my model, regenerated everything with a clean db, and when the
> first commit is called, following error on server side:
>
> [ERROR] Rollback in HibernateStore: org.eclipse.emf.teneo.annotations.parser.AnnotationParserException: The eclass:
> HbAnnotatedEPackage does not have an efeature for Lob
To me this looks like a problem in Teneo. Martin?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> at
> org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.processAnnotatedModelElement(EAnnotationParserImporter.java:149)
>
> at org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.process(EAnnotationParserImporter.java:65)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:171)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:88)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:80)
> at org.eclipse.emf.teneo.hibernate.mapper.MappingUtil.generateMapping(MappingUtil.java:81)
> at org.eclipse.emf.cdo.server.hibernate.teneo.CDOMappingGenerator.generateMapping(CDOMappingGenerator.java:117)
> at
> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.generateMapping(TeneoHibernateMappingProvider.java:146)
> at
> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.getMapping(TeneoHibernateMappingProvider.java:76)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.initConfiguration(HibernateStore.java:520)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.getHibernateSessionFactory(HibernateStore.java:256)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.beginHibernateSession(HibernateStoreAccessor.java:194)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.getNewHibernateSession(HibernateStoreAccessor.java:291)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.doWrite(HibernateStoreAccessor.java:661)
> at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:487)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:43)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
> at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:262)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:96)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:86)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:92)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:65)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:149)
> 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:680)
>
> Any idea what could be the problem?
>
> Thanks
> Kris
>
>
>
> Am 02.02.13 15:32, schrieb KW:
>> Should work like described here:
>> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>>
>>
>> In the Load Resource Pop-Up I chose "Browse Registered Packages" and
>> then "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default
>> option "Development Time Version" instead of "Runtime Version".
>>
>> Is the "Development Time Version" option correct?
>>
>> Thanks
>> Kris
>>
>> Am 02.02.13 15:10, schrieb KW:
>>> Hello Eike,
>>>
>>> thanks! At first sight of LobTest I thought it is CDO DB Store specific
>>> and I have to search for another solution when using hibernate store.
>>> Apparently, it is not.
>>>
>>> Is there any further info on how to load the etypes.ecore into the
>>> model, as mentioned in
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=284307 -> Comment 16?
>>>
>>> Thanks
>>> Kris
>>>
>>>
>>> Am 02.02.13 13:30, schrieb Eike Stepper:
>>>> Am 02.02.2013 13:02, schrieb KW:
>>>>> Hi,
>>>>>
>>>>> I am currently struggling with the problem that I do not know how to
>>>>> write / read a LOB typed attribute of an Ecore model into the DB as
>>>>> stream (to prevent OutOfMemory errors - want to save files in the db).
>>>>>
>>>>> I defined the Ecore model like described in the Teneo Wiki:
>>>>> http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Teneo_Annotation_Examples
>>>>>
>>>>>
>>>>> --> Lob Annotation
>>>>>
>>>>> Furthermore the wiki tells how to create a java.sql.Blob with a
>>>>> Hibernate method which doesn't seem to be available any more.
>>>>>
>>>>> Blob blob = Hibernate.createBlob(new byte[] { 1, 2, 3, 4 });
>>>>>
>>>>> It seems that a Hibernate Session is needed for creating a Blob:
>>>>>
>>>>> LobHelper myLobHelper = org.hibernate.Session.getLobHelper
>>>>> Blob myBlob = myLobHelper.createBlob(InputStream stream,
>>>>> long length)
>>>>>
>>>>> Is there a way to get the underlying hibernate session to accomplish
>>>>> this?
>>>>>
>>>>> Is this the correct approach anyhow to to write / read LOBs
>>>>> stream-based to/from the DB?
>>>> Why do you mention the DB? Are you trying to do things on the server
>>>> side?
>>>>
>>>> Normally you would just interface the model API on the client side. Some
>>>> usage examples are in LobTest:
>>>> http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LobTest.java
>>>>
>>>>
>>>>
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>
>>
>


Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006938 is a reply to message #1006829] Sun, 03 February 2013 05:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.02.2013 15:32, schrieb KW:
> Should work like described here:
> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>
> In the Load Resource Pop-Up I chose "Browse Registered Packages" and then
> "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default option "Development Time Version" instead of
> "Runtime Version".
>
> Is the "Development Time Version" option correct?
I didn't know that these options exist. When I try "Development Time Version" I still end up with a
"platform:/plugin/..." URI, while I expected to see a "platform:/resource/..." URI. Perhaps Ed can comment on the
rationale of these options.

I usually import the containing plugin into the workspace and then load the desired model from there.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006941 is a reply to message #1006840] Sun, 03 February 2013 05:15 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.02.2013 19:38, schrieb KW:
> I was able to use the Blob type from the etypes in my model, regenerated everything with a clean db, and when the
> first commit is called, following error on server side:
>
> [ERROR] Rollback in HibernateStore: org.eclipse.emf.teneo.annotations.parser.AnnotationParserException: The eclass:
> HbAnnotatedEPackage does not have an efeature for Lob
To me this looks like a problem in Teneo. Martin?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> at
> org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.processAnnotatedModelElement(EAnnotationParserImporter.java:149)
>
> at org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.process(EAnnotationParserImporter.java:65)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:171)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:88)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:80)
> at org.eclipse.emf.teneo.hibernate.mapper.MappingUtil.generateMapping(MappingUtil.java:81)
> at org.eclipse.emf.cdo.server.hibernate.teneo.CDOMappingGenerator.generateMapping(CDOMappingGenerator.java:117)
> at
> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.generateMapping(TeneoHibernateMappingProvider.java:146)
> at
> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.getMapping(TeneoHibernateMappingProvider.java:76)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.initConfiguration(HibernateStore.java:520)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.getHibernateSessionFactory(HibernateStore.java:256)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.beginHibernateSession(HibernateStoreAccessor.java:194)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.getNewHibernateSession(HibernateStoreAccessor.java:291)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.doWrite(HibernateStoreAccessor.java:661)
> at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:487)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:43)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
> at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:262)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:96)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:86)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:92)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:65)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:149)
> 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:680)
>
> Any idea what could be the problem?
>
> Thanks
> Kris
>
>
>
> Am 02.02.13 15:32, schrieb KW:
>> Should work like described here:
>> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>>
>>
>> In the Load Resource Pop-Up I chose "Browse Registered Packages" and
>> then "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default
>> option "Development Time Version" instead of "Runtime Version".
>>
>> Is the "Development Time Version" option correct?
>>
>> Thanks
>> Kris
>>
>> Am 02.02.13 15:10, schrieb KW:
>>> Hello Eike,
>>>
>>> thanks! At first sight of LobTest I thought it is CDO DB Store specific
>>> and I have to search for another solution when using hibernate store.
>>> Apparently, it is not.
>>>
>>> Is there any further info on how to load the etypes.ecore into the
>>> model, as mentioned in
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=284307 -> Comment 16?
>>>
>>> Thanks
>>> Kris
>>>
>>>
>>> Am 02.02.13 13:30, schrieb Eike Stepper:
>>>> Am 02.02.2013 13:02, schrieb KW:
>>>>> Hi,
>>>>>
>>>>> I am currently struggling with the problem that I do not know how to
>>>>> write / read a LOB typed attribute of an Ecore model into the DB as
>>>>> stream (to prevent OutOfMemory errors - want to save files in the db).
>>>>>
>>>>> I defined the Ecore model like described in the Teneo Wiki:
>>>>> http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Teneo_Annotation_Examples
>>>>>
>>>>>
>>>>> --> Lob Annotation
>>>>>
>>>>> Furthermore the wiki tells how to create a java.sql.Blob with a
>>>>> Hibernate method which doesn't seem to be available any more.
>>>>>
>>>>> Blob blob = Hibernate.createBlob(new byte[] { 1, 2, 3, 4 });
>>>>>
>>>>> It seems that a Hibernate Session is needed for creating a Blob:
>>>>>
>>>>> LobHelper myLobHelper = org.hibernate.Session.getLobHelper
>>>>> Blob myBlob = myLobHelper.createBlob(InputStream stream,
>>>>> long length)
>>>>>
>>>>> Is there a way to get the underlying hibernate session to accomplish
>>>>> this?
>>>>>
>>>>> Is this the correct approach anyhow to to write / read LOBs
>>>>> stream-based to/from the DB?
>>>> Why do you mention the DB? Are you trying to do things on the server
>>>> side?
>>>>
>>>> Normally you would just interface the model API on the client side. Some
>>>> usage examples are in LobTest:
>>>> http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LobTest.java
>>>>
>>>>
>>>>
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>
>>
>


Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006942 is a reply to message #1006829] Sun, 03 February 2013 05:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.02.2013 15:32, schrieb KW:
> Should work like described here:
> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>
> In the Load Resource Pop-Up I chose "Browse Registered Packages" and then
> "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default option "Development Time Version" instead of
> "Runtime Version".
>
> Is the "Development Time Version" option correct?
I didn't know that these options exist. When I try "Development Time Version" I still end up with a
"platform:/plugin/..." URI, while I expected to see a "platform:/resource/..." URI. Perhaps Ed can comment on the
rationale of these options.

I usually import the containing plugin into the workspace and then load the desired model from there.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006945 is a reply to message #1006840] Sun, 03 February 2013 05:15 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.02.2013 19:38, schrieb KW:
> I was able to use the Blob type from the etypes in my model, regenerated everything with a clean db, and when the
> first commit is called, following error on server side:
>
> [ERROR] Rollback in HibernateStore: org.eclipse.emf.teneo.annotations.parser.AnnotationParserException: The eclass:
> HbAnnotatedEPackage does not have an efeature for Lob
To me this looks like a problem in Teneo. Martin?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> at
> org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.processAnnotatedModelElement(EAnnotationParserImporter.java:149)
>
> at org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.process(EAnnotationParserImporter.java:65)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:171)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:88)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:80)
> at org.eclipse.emf.teneo.hibernate.mapper.MappingUtil.generateMapping(MappingUtil.java:81)
> at org.eclipse.emf.cdo.server.hibernate.teneo.CDOMappingGenerator.generateMapping(CDOMappingGenerator.java:117)
> at
> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.generateMapping(TeneoHibernateMappingProvider.java:146)
> at
> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.getMapping(TeneoHibernateMappingProvider.java:76)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.initConfiguration(HibernateStore.java:520)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.getHibernateSessionFactory(HibernateStore.java:256)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.beginHibernateSession(HibernateStoreAccessor.java:194)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.getNewHibernateSession(HibernateStoreAccessor.java:291)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.doWrite(HibernateStoreAccessor.java:661)
> at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:487)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:43)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
> at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:262)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:96)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:86)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:92)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:65)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:149)
> 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:680)
>
> Any idea what could be the problem?
>
> Thanks
> Kris
>
>
>
> Am 02.02.13 15:32, schrieb KW:
>> Should work like described here:
>> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>>
>>
>> In the Load Resource Pop-Up I chose "Browse Registered Packages" and
>> then "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default
>> option "Development Time Version" instead of "Runtime Version".
>>
>> Is the "Development Time Version" option correct?
>>
>> Thanks
>> Kris
>>
>> Am 02.02.13 15:10, schrieb KW:
>>> Hello Eike,
>>>
>>> thanks! At first sight of LobTest I thought it is CDO DB Store specific
>>> and I have to search for another solution when using hibernate store.
>>> Apparently, it is not.
>>>
>>> Is there any further info on how to load the etypes.ecore into the
>>> model, as mentioned in
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=284307 -> Comment 16?
>>>
>>> Thanks
>>> Kris
>>>
>>>
>>> Am 02.02.13 13:30, schrieb Eike Stepper:
>>>> Am 02.02.2013 13:02, schrieb KW:
>>>>> Hi,
>>>>>
>>>>> I am currently struggling with the problem that I do not know how to
>>>>> write / read a LOB typed attribute of an Ecore model into the DB as
>>>>> stream (to prevent OutOfMemory errors - want to save files in the db).
>>>>>
>>>>> I defined the Ecore model like described in the Teneo Wiki:
>>>>> http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Teneo_Annotation_Examples
>>>>>
>>>>>
>>>>> --> Lob Annotation
>>>>>
>>>>> Furthermore the wiki tells how to create a java.sql.Blob with a
>>>>> Hibernate method which doesn't seem to be available any more.
>>>>>
>>>>> Blob blob = Hibernate.createBlob(new byte[] { 1, 2, 3, 4 });
>>>>>
>>>>> It seems that a Hibernate Session is needed for creating a Blob:
>>>>>
>>>>> LobHelper myLobHelper = org.hibernate.Session.getLobHelper
>>>>> Blob myBlob = myLobHelper.createBlob(InputStream stream,
>>>>> long length)
>>>>>
>>>>> Is there a way to get the underlying hibernate session to accomplish
>>>>> this?
>>>>>
>>>>> Is this the correct approach anyhow to to write / read LOBs
>>>>> stream-based to/from the DB?
>>>> Why do you mention the DB? Are you trying to do things on the server
>>>> side?
>>>>
>>>> Normally you would just interface the model API on the client side. Some
>>>> usage examples are in LobTest:
>>>> http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LobTest.java
>>>>
>>>>
>>>>
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>
>>
>


Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006946 is a reply to message #1006829] Sun, 03 February 2013 05:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.02.2013 15:32, schrieb KW:
> Should work like described here:
> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>
> In the Load Resource Pop-Up I chose "Browse Registered Packages" and then
> "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default option "Development Time Version" instead of
> "Runtime Version".
>
> Is the "Development Time Version" option correct?
I didn't know that these options exist. When I try "Development Time Version" I still end up with a
"platform:/plugin/..." URI, while I expected to see a "platform:/resource/..." URI. Perhaps Ed can comment on the
rationale of these options.

I usually import the containing plugin into the workspace and then load the desired model from there.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006949 is a reply to message #1006840] Sun, 03 February 2013 05:15 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.02.2013 19:38, schrieb KW:
> I was able to use the Blob type from the etypes in my model, regenerated everything with a clean db, and when the
> first commit is called, following error on server side:
>
> [ERROR] Rollback in HibernateStore: org.eclipse.emf.teneo.annotations.parser.AnnotationParserException: The eclass:
> HbAnnotatedEPackage does not have an efeature for Lob
To me this looks like a problem in Teneo. Martin?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> at
> org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.processAnnotatedModelElement(EAnnotationParserImporter.java:149)
>
> at org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.process(EAnnotationParserImporter.java:65)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:171)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:88)
> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:80)
> at org.eclipse.emf.teneo.hibernate.mapper.MappingUtil.generateMapping(MappingUtil.java:81)
> at org.eclipse.emf.cdo.server.hibernate.teneo.CDOMappingGenerator.generateMapping(CDOMappingGenerator.java:117)
> at
> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.generateMapping(TeneoHibernateMappingProvider.java:146)
> at
> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.getMapping(TeneoHibernateMappingProvider.java:76)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.initConfiguration(HibernateStore.java:520)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.getHibernateSessionFactory(HibernateStore.java:256)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.beginHibernateSession(HibernateStoreAccessor.java:194)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.getNewHibernateSession(HibernateStoreAccessor.java:291)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.doWrite(HibernateStoreAccessor.java:661)
> at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:487)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:43)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
> at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:262)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:96)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:86)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:92)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:65)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:149)
> 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:680)
>
> Any idea what could be the problem?
>
> Thanks
> Kris
>
>
>
> Am 02.02.13 15:32, schrieb KW:
>> Should work like described here:
>> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>>
>>
>> In the Load Resource Pop-Up I chose "Browse Registered Packages" and
>> then "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default
>> option "Development Time Version" instead of "Runtime Version".
>>
>> Is the "Development Time Version" option correct?
>>
>> Thanks
>> Kris
>>
>> Am 02.02.13 15:10, schrieb KW:
>>> Hello Eike,
>>>
>>> thanks! At first sight of LobTest I thought it is CDO DB Store specific
>>> and I have to search for another solution when using hibernate store.
>>> Apparently, it is not.
>>>
>>> Is there any further info on how to load the etypes.ecore into the
>>> model, as mentioned in
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=284307 -> Comment 16?
>>>
>>> Thanks
>>> Kris
>>>
>>>
>>> Am 02.02.13 13:30, schrieb Eike Stepper:
>>>> Am 02.02.2013 13:02, schrieb KW:
>>>>> Hi,
>>>>>
>>>>> I am currently struggling with the problem that I do not know how to
>>>>> write / read a LOB typed attribute of an Ecore model into the DB as
>>>>> stream (to prevent OutOfMemory errors - want to save files in the db).
>>>>>
>>>>> I defined the Ecore model like described in the Teneo Wiki:
>>>>> http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Teneo_Annotation_Examples
>>>>>
>>>>>
>>>>> --> Lob Annotation
>>>>>
>>>>> Furthermore the wiki tells how to create a java.sql.Blob with a
>>>>> Hibernate method which doesn't seem to be available any more.
>>>>>
>>>>> Blob blob = Hibernate.createBlob(new byte[] { 1, 2, 3, 4 });
>>>>>
>>>>> It seems that a Hibernate Session is needed for creating a Blob:
>>>>>
>>>>> LobHelper myLobHelper = org.hibernate.Session.getLobHelper
>>>>> Blob myBlob = myLobHelper.createBlob(InputStream stream,
>>>>> long length)
>>>>>
>>>>> Is there a way to get the underlying hibernate session to accomplish
>>>>> this?
>>>>>
>>>>> Is this the correct approach anyhow to to write / read LOBs
>>>>> stream-based to/from the DB?
>>>> Why do you mention the DB? Are you trying to do things on the server
>>>> side?
>>>>
>>>> Normally you would just interface the model API on the client side. Some
>>>> usage examples are in LobTest:
>>>> http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LobTest.java
>>>>
>>>>
>>>>
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>
>>
>


Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006950 is a reply to message #1006829] Sun, 03 February 2013 05:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.02.2013 15:32, schrieb KW:
> Should work like described here:
> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>
> In the Load Resource Pop-Up I chose "Browse Registered Packages" and then
> "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default option "Development Time Version" instead of
> "Runtime Version".
>
> Is the "Development Time Version" option correct?
I didn't know that these options exist. When I try "Development Time Version" I still end up with a
"platform:/plugin/..." URI, while I expected to see a "platform:/resource/..." URI. Perhaps Ed can comment on the
rationale of these options.

I usually import the containing plugin into the workspace and then load the desired model from there.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006953 is a reply to message #1006829] Sun, 03 February 2013 05:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.02.2013 15:32, schrieb KW:
> Should work like described here:
> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>
> In the Load Resource Pop-Up I chose "Browse Registered Packages" and then
> "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default option "Development Time Version" instead of
> "Runtime Version".
>
> Is the "Development Time Version" option correct?
I didn't know that these options exist. When I try "Development Time Version" I still end up with a
"platform:/plugin/..." URI, while I expected to see a "platform:/resource/..." URI. Perhaps Ed can comment on the
rationale of these options.

I usually import the containing plugin into the workspace and then load the desired model from there.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006954 is a reply to message #1006870] Sun, 03 February 2013 07:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Eike,

No, I'd expect that to yield a platform:/plugin URI (that references the
serialized model in the bundle). The Target Platform Version is a
better option in recent builds; it resolves to bundle in the target
platform rather than in the running IDE and uses platform:/resource
(because all target platform bundles are, via URI mapping, made to
appear as if they are projects in the workspace).


On 03/02/2013 6:21 AM, Eike Stepper wrote:
> Am 02.02.2013 15:32, schrieb KW:
>> Should work like described here:
>> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>>
>> In the Load Resource Pop-Up I chose "Browse Registered Packages" and
>> then "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the
>> default option "Development Time Version" instead of "Runtime Version".
>>
>> Is the "Development Time Version" option correct?
> I didn't know that these options exist. When I try "Development Time
> Version" I still end up with a "platform:/plugin/..." URI, while I
> expected to see a "platform:/resource/..." URI. Perhaps Ed can comment
> on the rationale of these options.
>
> I usually import the containing plugin into the workspace and then
> load the desired model from there.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006955 is a reply to message #1006870] Sun, 03 February 2013 07:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Eike,

No, I'd expect that to yield a platform:/plugin URI (that references the
serialized model in the bundle). The Target Platform Version is a
better option in recent builds; it resolves to bundle in the target
platform rather than in the running IDE and uses platform:/resource
(because all target platform bundles are, via URI mapping, made to
appear as if they are projects in the workspace).


On 03/02/2013 6:21 AM, Eike Stepper wrote:
> Am 02.02.2013 15:32, schrieb KW:
>> Should work like described here:
>> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>>
>> In the Load Resource Pop-Up I chose "Browse Registered Packages" and
>> then "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the
>> default option "Development Time Version" instead of "Runtime Version".
>>
>> Is the "Development Time Version" option correct?
> I didn't know that these options exist. When I try "Development Time
> Version" I still end up with a "platform:/plugin/..." URI, while I
> expected to see a "platform:/resource/..." URI. Perhaps Ed can comment
> on the rationale of these options.
>
> I usually import the containing plugin into the workspace and then
> load the desired model from there.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006956 is a reply to message #1006870] Sun, 03 February 2013 07:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Eike,

No, I'd expect that to yield a platform:/plugin URI (that references the
serialized model in the bundle). The Target Platform Version is a
better option in recent builds; it resolves to bundle in the target
platform rather than in the running IDE and uses platform:/resource
(because all target platform bundles are, via URI mapping, made to
appear as if they are projects in the workspace).


On 03/02/2013 6:21 AM, Eike Stepper wrote:
> Am 02.02.2013 15:32, schrieb KW:
>> Should work like described here:
>> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>>
>> In the Load Resource Pop-Up I chose "Browse Registered Packages" and
>> then "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the
>> default option "Development Time Version" instead of "Runtime Version".
>>
>> Is the "Development Time Version" option correct?
> I didn't know that these options exist. When I try "Development Time
> Version" I still end up with a "platform:/plugin/..." URI, while I
> expected to see a "platform:/resource/..." URI. Perhaps Ed can comment
> on the rationale of these options.
>
> I usually import the containing plugin into the workspace and then
> load the desired model from there.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006977 is a reply to message #1006867] Sun, 03 February 2013 13:27 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Kris,
It seems that the Lob annotation is on the EPackage, it should be on the efeature storing the lob. But... for CDO/Teneo
you don't need to set the @Lob annotation. You don't need to use the Hibernate Lob either.

To work with blob/clob you should use the CDO Blob/CLOb types from the CDO ETypes epackage. Teneo will automatically
take care of mapping them as lobs.

gr. Martin

On 02/03/2013 06:15 AM, Eike Stepper wrote:
> Am 02.02.2013 19:38, schrieb KW:
>> I was able to use the Blob type from the etypes in my model, regenerated everything with a clean db, and when the
>> first commit is called, following error on server side:
>>
>> [ERROR] Rollback in HibernateStore: org.eclipse.emf.teneo.annotations.parser.AnnotationParserException: The eclass:
>> HbAnnotatedEPackage does not have an efeature for Lob
> To me this looks like a problem in Teneo. Martin?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>> at
>> org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.processAnnotatedModelElement(EAnnotationParserImporter.java:149)
>>
>> at org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.process(EAnnotationParserImporter.java:65)
>> at
>> org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:171)
>> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:88)
>> at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:80)
>> at org.eclipse.emf.teneo.hibernate.mapper.MappingUtil.generateMapping(MappingUtil.java:81)
>> at org.eclipse.emf.cdo.server.hibernate.teneo.CDOMappingGenerator.generateMapping(CDOMappingGenerator.java:117)
>> at
>> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.generateMapping(TeneoHibernateMappingProvider.java:146)
>>
>> at
>> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.getMapping(TeneoHibernateMappingProvider.java:76)
>>
>> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.initConfiguration(HibernateStore.java:520)
>> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.getHibernateSessionFactory(HibernateStore.java:256)
>> at
>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.beginHibernateSession(HibernateStoreAccessor.java:194)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.getNewHibernateSession(HibernateStoreAccessor.java:291)
>>
>> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.doWrite(HibernateStoreAccessor.java:661)
>> at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
>> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:487)
>> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:43)
>> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
>> at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
>> at
>> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:262)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:96)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
>>
>> at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:86)
>> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:92)
>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
>> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
>> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:65)
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
>> at org.eclipse.net4j.signal.Signal.run(Signal.java:149)
>> 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:680)
>>
>> Any idea what could be the problem?
>>
>> Thanks
>> Kris
>>
>>
>>
>> Am 02.02.13 15:32, schrieb KW:
>>> Should work like described here:
>>> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>>>
>>>
>>> In the Load Resource Pop-Up I chose "Browse Registered Packages" and
>>> then "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default
>>> option "Development Time Version" instead of "Runtime Version".
>>>
>>> Is the "Development Time Version" option correct?
>>>
>>> Thanks
>>> Kris
>>>
>>> Am 02.02.13 15:10, schrieb KW:
>>>> Hello Eike,
>>>>
>>>> thanks! At first sight of LobTest I thought it is CDO DB Store specific
>>>> and I have to search for another solution when using hibernate store.
>>>> Apparently, it is not.
>>>>
>>>> Is there any further info on how to load the etypes.ecore into the
>>>> model, as mentioned in
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=284307 -> Comment 16?
>>>>
>>>> Thanks
>>>> Kris
>>>>
>>>>
>>>> Am 02.02.13 13:30, schrieb Eike Stepper:
>>>>> Am 02.02.2013 13:02, schrieb KW:
>>>>>> Hi,
>>>>>>
>>>>>> I am currently struggling with the problem that I do not know how to
>>>>>> write / read a LOB typed attribute of an Ecore model into the DB as
>>>>>> stream (to prevent OutOfMemory errors - want to save files in the db).
>>>>>>
>>>>>> I defined the Ecore model like described in the Teneo Wiki:
>>>>>> http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Teneo_Annotation_Examples
>>>>>>
>>>>>>
>>>>>> --> Lob Annotation
>>>>>>
>>>>>> Furthermore the wiki tells how to create a java.sql.Blob with a
>>>>>> Hibernate method which doesn't seem to be available any more.
>>>>>>
>>>>>> Blob blob = Hibernate.createBlob(new byte[] { 1, 2, 3, 4 });
>>>>>>
>>>>>> It seems that a Hibernate Session is needed for creating a Blob:
>>>>>>
>>>>>> LobHelper myLobHelper = org.hibernate.Session.getLobHelper
>>>>>> Blob myBlob = myLobHelper.createBlob(InputStream stream,
>>>>>> long length)
>>>>>>
>>>>>> Is there a way to get the underlying hibernate session to accomplish
>>>>>> this?
>>>>>>
>>>>>> Is this the correct approach anyhow to to write / read LOBs
>>>>>> stream-based to/from the DB?
>>>>> Why do you mention the DB? Are you trying to do things on the server
>>>>> side?
>>>>>
>>>>> Normally you would just interface the model API on the client side. Some
>>>>> usage examples are in LobTest:
>>>>> http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LobTest.java
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://www.esc-net.de
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
>>>>
>>>
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1007191 is a reply to message #1006977] Mon, 04 February 2013 21:27 Go to previous message
Kris Missing name is currently offline Kris Missing nameFriend
Messages: 47
Registered: July 2009
Member
Hooray - it works now!

I don't know why the annation went up to package level - I assume it
happened accidentaly when I was referencin the cdo etypes types via
"Load Resource".

Thank you Eike / Ed / Martin!



Am 03.02.13 14:27, schrieb Martin Taal:
> Hi Kris,
> It seems that the Lob annotation is on the EPackage, it should be on the
> efeature storing the lob. But... for CDO/Teneo you don't need to set the
> @Lob annotation. You don't need to use the Hibernate Lob either.
>
> To work with blob/clob you should use the CDO Blob/CLOb types from the
> CDO ETypes epackage. Teneo will automatically take care of mapping them
> as lobs.
>
> gr. Martin
>
> On 02/03/2013 06:15 AM, Eike Stepper wrote:
>> Am 02.02.2013 19:38, schrieb KW:
>>> I was able to use the Blob type from the etypes in my model,
>>> regenerated everything with a clean db, and when the
>>> first commit is called, following error on server side:
>>>
>>> [ERROR] Rollback in HibernateStore:
>>> org.eclipse.emf.teneo.annotations.parser.AnnotationParserException:
>>> The eclass:
>>> HbAnnotatedEPackage does not have an efeature for Lob
>> To me this looks like a problem in Teneo. Martin?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>> at
>>> org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.processAnnotatedModelElement(EAnnotationParserImporter.java:149)
>>>
>>>
>>> at
>>> org.eclipse.emf.teneo.annotations.parser.EAnnotationParserImporter.process(EAnnotationParserImporter.java:65)
>>>
>>> at
>>> org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:171)
>>>
>>> at
>>> org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:88)
>>>
>>> at
>>> org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:80)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.mapper.MappingUtil.generateMapping(MappingUtil.java:81)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.hibernate.teneo.CDOMappingGenerator.generateMapping(CDOMappingGenerator.java:117)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.generateMapping(TeneoHibernateMappingProvider.java:146)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.hibernate.internal.teneo.TeneoHibernateMappingProvider.getMapping(TeneoHibernateMappingProvider.java:76)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.initConfiguration(HibernateStore.java:520)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore.getHibernateSessionFactory(HibernateStore.java:256)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.beginHibernateSession(HibernateStoreAccessor.java:194)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.getNewHibernateSession(HibernateStoreAccessor.java:291)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.doWrite(HibernateStoreAccessor.java:661)
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:487)
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:43)
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
>>>
>>> at
>>> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:262)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:96)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:86)
>>>
>>> at
>>> org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:92)
>>>
>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
>>> at
>>> org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
>>>
>>> at
>>> org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:65)
>>>
>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
>>> at org.eclipse.net4j.signal.Signal.run(Signal.java:149)
>>> 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:680)
>>>
>>> Any idea what could be the problem?
>>>
>>> Thanks
>>> Kris
>>>
>>>
>>>
>>> Am 02.02.13 15:32, schrieb KW:
>>>> Should work like described here:
>>>> http://stackoverflow.com/questions/9384813/can-i-reuse-ecore-models-by-importing-them-into-other-models
>>>>
>>>>
>>>>
>>>> In the Load Resource Pop-Up I chose "Browse Registered Packages" and
>>>> then "http://www.eclipse.org/emf/CDO/Etypes/4.0.0" and let the default
>>>> option "Development Time Version" instead of "Runtime Version".
>>>>
>>>> Is the "Development Time Version" option correct?
>>>>
>>>> Thanks
>>>> Kris
>>>>
>>>> Am 02.02.13 15:10, schrieb KW:
>>>>> Hello Eike,
>>>>>
>>>>> thanks! At first sight of LobTest I thought it is CDO DB Store
>>>>> specific
>>>>> and I have to search for another solution when using hibernate store.
>>>>> Apparently, it is not.
>>>>>
>>>>> Is there any further info on how to load the etypes.ecore into the
>>>>> model, as mentioned in
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=284307 -> Comment 16?
>>>>>
>>>>> Thanks
>>>>> Kris
>>>>>
>>>>>
>>>>> Am 02.02.13 13:30, schrieb Eike Stepper:
>>>>>> Am 02.02.2013 13:02, schrieb KW:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am currently struggling with the problem that I do not know how to
>>>>>>> write / read a LOB typed attribute of an Ecore model into the DB as
>>>>>>> stream (to prevent OutOfMemory errors - want to save files in the
>>>>>>> db).
>>>>>>>
>>>>>>> I defined the Ecore model like described in the Teneo Wiki:
>>>>>>> http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Teneo_Annotation_Examples
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --> Lob Annotation
>>>>>>>
>>>>>>> Furthermore the wiki tells how to create a java.sql.Blob with a
>>>>>>> Hibernate method which doesn't seem to be available any more.
>>>>>>>
>>>>>>> Blob blob = Hibernate.createBlob(new byte[] { 1, 2, 3, 4 });
>>>>>>>
>>>>>>> It seems that a Hibernate Session is needed for creating a Blob:
>>>>>>>
>>>>>>> LobHelper myLobHelper = org.hibernate.Session.getLobHelper
>>>>>>> Blob myBlob = myLobHelper.createBlob(InputStream stream,
>>>>>>> long length)
>>>>>>>
>>>>>>> Is there a way to get the underlying hibernate session to accomplish
>>>>>>> this?
>>>>>>>
>>>>>>> Is this the correct approach anyhow to to write / read LOBs
>>>>>>> stream-based to/from the DB?
>>>>>> Why do you mention the DB? Are you trying to do things on the server
>>>>>> side?
>>>>>>
>>>>>> Normally you would just interface the model API on the client
>>>>>> side. Some
>>>>>> usage examples are in LobTest:
>>>>>> http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LobTest.java
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://www.esc-net.de
>>>>>> http://thegordian.blogspot.com
>>>>>> http://twitter.com/eikestepper
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
>
Previous Topic:Copy EObject with eOpposite refs
Next Topic:[CDO] and eAdapters
Goto Forum:
  


Current Time: Fri Apr 26 09:25:01 GMT 2024

Powered by FUDForum. Page generated in 0.04732 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top