i have another newbie question. i tried to read parts of the documentation but i could not find the solution.
i have this two persistent classes,
Code:
public class PCard{
private String id;
private String serial;
.....
}
public class PSession {
private String id;
private Date startTime;
private Date endTime;
private PCard card;
......
}
Both uses same id generation mechanism, something like that in their mapping file, for session:
Code:
<id name="id" type="string" unsaved-value="null" >
<column name="session_id" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>
and Session includes this many-to-one relation line in the mapping file
Code:
<many-to-one name="card"
class="PCard"
column="card_id" />
But when i wanted to use schema export for HSQLDB, it produces this tables for the objects, and gives a type error for friend key constraints because of the type difference. Question is, why the system makes the value of card_id in session table as VARCHAR? i know it is a simple mistake but i am confused..
Code:
create table cards (
card_id char(32) not null,
serial char(255) not null,
primary key (card_id)
)
create table sessions (
session_id char(32) not null,
start_time date not null,
end_time date not null,
card_id VARCHAR(255),
primary key (session_id)
)