The easy way is to use java.util.Date instead, this maps to Datetime
datatype, works for me.
Klaus
> -----Opprinnelig melding-----
> Fra: Somdeth Souvanlasy [mailto:[EMAIL PROTECTED]]
> Sendt: 22. november 2000 11:37
> Til: Orion-Interest
> Emne: database schema mapping and MS SQL Server 7 - does the schema
> mapping work ? How do I make it work ?
>
> Hi,
>
> The orionserver site isn't responding today, so I can't check bugzilla to
> see if this is an outstanding bug.....
>
> Configuration
> Orion 1.4.0
> Windows 2000 Professional
> Sun JDK 1.3
> MS SQL Server 7
> BEA Weblogic MSSQLServer 7 type 4 JDBC drivers version 5.1.0 (evaluation
> drivers)
>
> Situation
> I'm trying to build a CMP entity bean that has a java.sql.Timestamp as one
> of the fields.... deploying the bean works fine - Orion creates the table
> with the correct column type for the timestamp field. However, when I do
> a create, I get back the following error:
>
> Error creating EntityBean: Disallowed implicit conversion from data type
> varchar to data type timestamp, table 'XXXXXX', column 'timeStamp'. Use
> the CONVERT function to run this query. Severity 16, State 1, Procedure
> 'XXXXXX null', Line 1 javax.ejb.CreateException: Error creating
> EntityBean: Disallowed implicit conversion from data type varchar to data
> type timestamp, table 'XXXXXXX', column 'timeStamp'. Use the CONVERT
> function to run this query. Severity 16, State 1, Procedure 'XXXXXXXX
> null', Line 1
> at com.evermind.server.rmi.bd.invokeMethod(JAX)
> at com.evermind.server.rmi.a4.invoke(JAX)
> at com.evermind.server.rmi.a5.invoke(JAX)
> at __Proxy1.create(Unknown Source)
> at TestEntityClient.main(TestEntityClient.java:35)
>
> which is a SQL Server error - to me this indicates that the container is
> trying to save the timestamp field to the table not as an actual SQL
> Server timestamp but as a string (varchar)...
>
> I then looked at the database-schemas\ms-sql.xml file and sure enough,
> there was no entry to map java.sql.Timestamp to the timestamp type for SQL
> Server. My data-sources.xml file specifies this file as the schema for
> the data source that I am using.
>
> I then added this line to the database-schemas\ms-sql.xml
>
> <type-mapping type="java.sql.Timestamp" name="timestamp" />
>
> hoping that this would fix the problem, but alas no.
>
> (converting the column in the table to be a varchar works - I can then
> create the entity beans and save them to the database, but then the
> timeStamp is a varchar, and any queries using the field are string
> comparisons.... - I want to be able to use the native SQL Server timestamp
> type)
>
> Does Orion use the mappings from the schema at all ? Have I specified the
> mapping incorrectly ? or is there something else I need to do ?
>
> Any help/ideas would be appreciated,
> Somdeth