Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO][Teneo] How to write / read LOB data stream based?
[CDO][Teneo] How to write / read LOB data stream based? [message #1006820] Sat, 02 February 2013 12:02 Go to next message
Kris Missing name is currently offline Kris Missing name
Messages: 47
Registered: July 2009
Member
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?

Thanks!
Kris
Re: [CDO][Teneo] How to write / read LOB data stream based? [message #1006822 is a reply to message #1006820] Sat, 02 February 2013 12:30 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5537
Registered: July 2009
Senior Member
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 #1006826 is a reply to message #1006822] Sat, 02 February 2013 14:10 Go to previous messageGo to next message
Kris Missing name is currently offline Kris Missing name
Messages: 47
Registered: July 2009
Member
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 #1006829 is a reply to message #1006826] Sat, 02 February 2013 14:32 Go to previous messageGo to next message
Kris Missing name is currently offline Kris Missing name
Messages: 47
Registered: July 2009
Member
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 #1006840 is a reply to message #1006829] Sat, 02 February 2013 18:38 Go to previous messageGo to next message
Kris Missing name is currently offline Kris Missing name
Messages: 47
Registered: July 2009
Member
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
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 #1006867 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 Stepper
Messages: 5537
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 #1006869 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 Stepper
Messages: 5537
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 #1006870 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 Stepper
Messages: 5537
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 #1006873 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 Stepper
Messages: 5537
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 #1006874 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 Stepper
Messages: 5537
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 #1006877 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 Stepper
Messages: 5537
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 #1006878 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 Stepper
Messages: 5537
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 #1006881 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 Stepper
Messages: 5537
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 #1006882 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 Stepper
Messages: 5537
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 #1006885 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 Stepper
Messages: 5537
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 #1006886 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 Stepper
Messages: 5537
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 #1006889 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 Stepper
Messages: 5537
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 #1006890 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 Stepper
Messages: 5537
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 #1006893 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 Stepper
Messages: 5537
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 #1006894 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 Stepper
Messages: 5537
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 #1006897 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 Stepper
Messages: 5537
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 #1006898 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 Stepper
Messages: 5537
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 #1006901 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 Stepper
Messages: 5537
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 #1006902 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 Stepper
Messages: 5537
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 #1006905 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 Stepper
Messages: 5537
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 #1006906 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 Stepper
Messages: 5537
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 #1006909 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 Stepper
Messages: 5537
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 #1006910 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 Stepper
Messages: 5537
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 #1006913 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 Stepper
Messages: 5537
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 #1006914 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 Stepper
Messages: 5537
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 #1006917 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 Stepper
Messages: 5537
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 #1006918 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 Stepper
Messages: 5537
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 #1006921 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 Stepper
Messages: 5537
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 #1006922 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 Stepper
Messages: 5537
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 #1006925 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 Stepper
Messages: 5537
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 #1006926 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 Stepper
Messages: 5537
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 #1006929 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 Stepper
Messages: 5537
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 #1006930 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 Stepper
Messages: 5537
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 #1006933 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 Stepper
Messages: 5537
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 #1006934 is a reply to message #1006829] Sun, 03 February 2013 05:21 Go to previous messageGo to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5537
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
Previous Topic:Copy EObject with eOpposite refs
Next Topic:[CDO] and eAdapters
Goto Forum:
  


Current Time: Tue Oct 21 00:39:41 GMT 2014

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

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