| RE: [smila-dev] JPA und SQL Server |
|
Hi Daniel, i understand we have
to save a blob but I'm not sure that we need to define in the Annotation which
DB type is going to be used for it. from the API Doc its not 100% clear but from
this columnDefinition public
abstract String columnDefinition (Optional) The
SQL fragment that is used when generating the DDL for the column. Defaults
to the generated SQL to create a column of the inferred type. Default: "" I deduct that the
string that u pass with columnDefinition is the one actually used to generate
the Table. if you leave it free then the DB Type Mapper (e.g. org.eclipse.persistence.platform.database.DerbyPlatform,
SqlServerPlaform) will chose a Type matching the variable's Type. For MSSQL
this works fine and it chooses Image as the column type and apparently it also
works for Derby when nothing is spec'ed. So, was there a
deeper reason for u spec BLOB (such as the default SQL type chosen with derby for
byte[] doesn’t meet the needs) or where u just not aware of this? Kind regards Thomas Menzel @ brox IT-Solutions GmbH From: smila-dev-bounces@xxxxxxxxxxx
[mailto:smila-dev-bounces@xxxxxxxxxxx] On Behalf Of Daniel.Stucky@xxxxxxxxxxx Hi Tom, it is required for
the method Iterator<Id>
obsoleteIdIterator(…). This
method returns Id objects, that have to be created from the content of the
database. The Id object cannot be generated from the ID-Hash, so we have to
store the Id object itself somehow in the database. I decided to use a
serialized Id and store it in a BLOB, as it should be the fastest way. Another
option would be to store the XML representation in a VARCHAR, but this also
implies some code changes, as the String has to be parsed into an Id object. Is it possible to use
a different data type to store the serialized Id ? Perhaps something like BYTE
instead of BLOB ? As far as I
understand eclipseLink it should be possible to override the code annotations
(defaults) by using a xml configuration file. In this way it should be possible
to change the data type of attribute ID in table DELTA_INDEXING . I did not make use of
this feature, so it is just a guess. Some code adjustment may also be needed to
enable the xml configuration. Bye, Daniel Von: smila-dev-bounces@xxxxxxxxxxx
[mailto:smila-dev-bounces@xxxxxxxxxxx] Im Auftrag von Thomas Menzel Hi Daniel and
Juergen, what was the reason
to use the database dependent columnDefinition = "BLOB"? e.g. @Column(name =
"BIN_OBJECT", columnDefinition = "BLOB") unfortunately this
doesn’t work for MSSQL so I had to remove it. Fortunately it works w/o it
for derby too, but I wonder about the reason…. PS: goody: a google for
"eclipselink jpa derby blob" will result in http://wiki.eclipse.org/SMILA/Documentation/Binary_Storage#eclipse.smila.binarystorage.persistence.jpa
as the first hit! ;) Kind regards Thomas Menzel @ brox IT-Solutions GmbH From: smila-dev-bounces@xxxxxxxxxxx
[mailto:smila-dev-bounces@xxxxxxxxxxx] On Behalf Of Thomas Menzel AARRRGGG i had mixed up the
PWD and user name!!! This resulted to the
misleading exception. No I get: [EL Warning]:
2009.08.06 15:00:21.085--ServerSession(29833103)--Exception
[EclipseLink-4002] (Eclipse Persistence Services - 1.0.2 (Build 20081024)): org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: com.microsoft.sqlserver.jdbc.SQLServerException:
Column, parameter, or variable #8: Cannot find data type BLOB. Error Code: 2715 Call: CREATE
TABLE DELTA_INDEXING (ID_HASH VARCHAR(1024) NOT NULL, HASH VARCHAR(1024) NULL,
SOURCE_ID VARCHAR(255) NULL, IS_COMPOUND BIT default 0 NULL, PARENT_ID_HASH
VARCHAR(1024) NULL, VISITED BIT default 0 NULL, MODIFIED BIT default 0 NULL, ID
BLOB, PRIMARY KEY (ID_HASH)) is blob not supported
for MSSQL? ..researching…. Mit freundlichen Grüßen / Kind regards Thomas Menzel brox IT-Solutions
GmbH ================================== From: smila-dev-bounces@xxxxxxxxxxx
[mailto:smila-dev-bounces@xxxxxxxxxxx] On Behalf Of Daniel.Stucky@xxxxxxxxxxx With java 1.6 a lot
more warnings are written to console than with 1.5 For the Derby
integration there are warnings, too, but no error messages! With MSSQL you get an
error message, so do not concern about warnings. Still no clue about
what could go wrong. Bye, Daniel Von:
smila-dev-bounces@xxxxxxxxxxx [mailto:smila-dev-bounces@xxxxxxxxxxx] Im
Auftrag von Thomas Menzel hi, i just retried
the Derby case and noticed that here it also complains about no suitable
driver, but later it works. could it be that
there are some workarounds for derby and oracle in place that mssql doenst have
? (and I also tried jtds to no avail) Mit freundlichen Grüßen / Kind regards Thomas Menzel brox IT-Solutions GmbH ================================== From: smila-dev-bounces@xxxxxxxxxxx
[mailto:smila-dev-bounces@xxxxxxxxxxx] On Behalf Of Daniel.Stucky@xxxxxxxxxxx Hi Tom, I cannot see any
issue with your implementation. I once successfully integrated Oracle instead
of Derby. The main issue is
that you need to import the jdbc driver classes in the deltaindexing.jpa
bundle, which you apparently did. I have no idea if
SQLServer needs any special handling. Perhaps you should try to connect with
JPA to SQL Server without using OSGi first, to check if there is a general
problem ? Bye, Daniel Von:
smila-dev-bounces@xxxxxxxxxxx [mailto:smila-dev-bounces@xxxxxxxxxxx] Im
Auftrag von Thomas Menzel hi jürgen, ich versuche mich gerade darin einen MSSQL als
implementierung für das deltaindexing zu konfigurieren. dazu habe ich 1. ein bundle für den MSSQL Driver erstellt 2. eine dependency vom jpa.impl bundle zu dem MSSQL driver
bundle ersellt 3. diese JPA config eclipselink.logging.level=INFO eclipselink.target-server=None eclipselink.target-database=org.eclipse.persistence.platform.database.SQLServerPlatform eclipselink.jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver eclipselink.jdbc.url="">jdbc:sqlserver://lh:1433;DatabaseName=smila eclipselink.ddl-generation=drop-and-create-tables eclipselink.jdbc.password=sa eclipselink.jdbc.user=xxx trotzdem sagt er mir: [EL Warning]: 2009.08.06
02:34:54.770--ServerSession(14791603)--java.sql.SQLException: No
suitable driver found for jdbc:sqlserver://localhost:1433 [ERROR]
DeltaIndexingManagerImpl - error activating class
org.eclipse.smila.connectivity.deltaindexing.jpa.impl.DeltaIndexingManagerImpl
<Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.0.2 (Build
20081024)): org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: java.sql.SQLException: No suitable driver found for
jdbc:sqlserver://localhost:1433 welchen trick muss ich anwenden, dass das hinhaut? da ich java 1.6 nutze, muss ich ja eigentlich nicht mehr
selber das Class.forName machen und selbst wenn ich's aufrufe, ändert es nix. der Class Name ist korrekt, wenn ich den änder meckert er
das er logischer weise die klasse nicht finden kann, daher dürfte Class
Path/bundle dependency technisch alles im grünen sein. hast du eine idee? Mit freundlichen Grüßen / Kind regards Thomas Menzel brox IT-Solutions
GmbH ================================== |