-
1. Re: seam-gen reverse engineering SQL Server question
asookazian Aug 6, 2009 1:17 AM (in response to mdesignz)I haven't had this problem with SQL SERVER 2005 and Seam 2.x revengr via seam-gen (hbm2java).
example:
@Temporal(TemporalType.TIMESTAMP) @Column(name = "AddedDate", nullable = false, length = 23) @NotNull public Date getAddedDate() { return this.addedDate; }
The metadata that hbm2java aquires for the db schema is based on whatever info comes from the jdbc driver. What jdbc driver and what version of that driver are you using?
I doubt you would need to do any custom config to get the annotations to be placed correctly in your entity classes. Otherwise, smells like a bug?
-
2. Re: seam-gen reverse engineering SQL Server question
mdesignz Aug 6, 2009 2:04 AM (in response to mdesignz)Thanks for the reply! I'm using MS' driver (sqljdbc4) and it gets the datetime (timestamp) values correctly. It's the Date only fields that it types to io.Serializable. I'm not a big SQL Server fan, so I don't have a lot of experience with it. Are there other jdbc drivers that play nicely with SQL Server (I haven't Googled that yet, but I will).
-
3. Re: seam-gen reverse engineering SQL Server question
mdesignz Aug 6, 2009 2:11 AM (in response to mdesignz)I neglected to post the exammple. Here's what Seam-Gen creates for a Date defined field:
@Column(name = "insurance_begins_date") public Serializable getInsuranceBeginsDate() { return this.insuranceBeginsDate; }
And this is what it generates for a datetime (timestamp) field:
@Temporal(TemporalType.TIMESTAMP) @Column(name = "update_date", length = 23) public Date getUpdateDate() { return this.updateDate; }
-
4. Re: seam-gen reverse engineering SQL Server question
kapitanpetko Aug 6, 2009 4:52 AM (in response to mdesignz)
Robert Morse wrote on Aug 06, 2009 02:04:
Are there other jdbc drivers that play nicely with SQL Server (I haven't Googled that yet, but I will).Try JTDS. Works great and is said to be much faster than the MS driver.
-
5. Re: seam-gen reverse engineering SQL Server question
asookazian Aug 6, 2009 6:16 AM (in response to mdesignz)You need to post this question on the hibernate forum or JBoss Tools forum b/c seam-gen uses Hibernate Tools (in this case hbm2java specifically) to do the revengr for you. This actually has nothing to do with Seam.
You may be able to specify some override for the Date fields in the seam-gen.reveng.xml so that it doesn't specify Serializable as the return type. IMO it is very strange that it's doing that. If that's java.io.Serializable, that is a marker interface, and is not supposed to be return by any method ever.
Read this as well: http://www.redhat.com/docs/en-US/JBoss_Developer_Studio/en/hibernatetools/html/codegen.html
As far as jTDS is concerned, never used it but on that web site itself it states it passes J2EE 1.3 certification. That's very old. But give it a shot to see what happens.
The other option is to refactor your Date columns to datetime type in your SQL SERVER tables.
There's a sqljdbc.jar which is version 2.0 that was released 04/2009. Try that one if you don't already have it.