- This topic has 4 replies, 2 voices, and was last updated 15 years, 2 months ago by support-joy.
-
AuthorPosts
-
Douglas M HurstParticipantI’ve RE’d some Oracle Tables. Even in DB Explorer, two of the fields indicate Timestamp. But on the RE, all are set to String. One example of generated code is shown below. Those in bold/italics/underscore should be Timestamp, not String.
/** minimal constructor */
public Assignee(String assigneeLoginId, String assigneeFirstName,
String assigneeLastName, String assigneePassword,
String rowAddedOprid, String rowAddedDttm, String rowLastmantOprid,
String rowLastmantDttm) {
super(assigneeLoginId, assigneeFirstName, assigneeLastName,
assigneePassword, rowAddedOprid, rowAddedDttm,
rowLastmantOprid, rowLastmantDttm);Also, when I did this Assignee in isolation, it did generate Timestamps, but when done with a large group of tables, it consistently produces String vice Timestamp.
Of course when I try to set the field, it takes a string, but I get an exception stating the month is invalid when I try to add a record at runtime.
support-joyMemberdouglasmhurst,
To avoid of getting String type for Timestamp type fields, I would recommend you to do the following steps.
1) Expand the tables which contains timestamp type field in 3rd wizard of Reverse Engineer.
2) Select timestamp type field.
3) Enter TIMESTAMP value for JDBC Type.
4) Enter timestamp value for Hibernate Type.
5) Repeat steps 2,3 and 4 for each timestamp type fields
6) Click FinishI hope this works for you.
Douglas M HurstParticipantThat works… sort of. I entered TIMESTAMP and timestamp on my two fields. What I’m seeing doesn’t look right.
In assignee.hbm.xml I see
<property name=”rowAddedDttm” type=”timestamp”>
<column name=”ROW_ADDED_DTTM” not-null=”true” />
</property>But in AbstractAssignee.java and Assignee.java I see old, depricated java.util.Date;
/** minimal constructor */
public Assignee(String assigneeLoginId, String assigneeFirstName,
String assigneeLastName, String assigneePassword,
String rowAddedOprid, Date rowAddedDttm, String rowLastmantOprid,
Date rowLastmantDttm) {
super(assigneeLoginId, assigneeFirstName, assigneeLastName,
assigneePassword, rowAddedOprid, rowAddedDttm,
rowLastmantOprid, rowLastmantDttm);…and in AssigneeDAO.java the fields are omitted altogether…
private static final Log log = LogFactory.getLog(AssigneeDAO.class);
// property constants
public static final String ASSIGNEE_FIRST_NAME = “assigneeFirstName”;
public static final String ASSIGNEE_LAST_NAME = “assigneeLastName”;
public static final String ASSIGNEE_PASSWORD = “assigneePassword”;
public static final String ASSIGNEE_PHONE = “assigneePhone”;
public static final String ASSIGNEE_EMAIL = “assigneeEmail”;
public static final String ROW_ADDED_OPRID = “rowAddedOprid”;
public static final String ROW_LASTMANT_OPRID = “rowLastmantOprid”;Why would I put in TIMESTAMP and timestamp and have it generate java.util.Date?
Douglas M HurstParticipant@support-joy wrote:
douglasmhurst,
To avoid of getting String type for Timestamp type fields, I would recommend you to do the following steps.
1) Expand the tables which contains timestamp type field in 3rd wizard of Reverse Engineer.
2) Select timestamp type field.
3) Enter TIMESTAMP value for JDBC Type.
4) Enter timestamp value for Hibernate Type.
5) Repeat steps 2,3 and 4 for each timestamp type fields
6) Click FinishI hope this works for you.
What I found worked better is TIMESTAMP and java.sql.Timestamp
Also, you must delete all generated RE files or some will not RE with the new values.
support-joyMemberWhat I found worked better is TIMESTAMP and java.sql.Timestamp
Also, you must delete all generated RE files or some will not RE with the new values.
Good to hear you are all set.Thanks for letting us know.
-
AuthorPosts