Sorry I did not make myself clear.
Here is what I did.
1. ran the first DDL below.
2. In my hibernate.cfg.xml, mapped the AAA.BBB table to a Hibernate entity
bean that looked something like this:
public class Bbb
{
private int id;
private String site;
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(unique=true)
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public String getSite()
{
return site;
}
public void setSite(String site)
{
this.site = site;
}
}
My Java program was able to CRUD these just fine.
3. Then I wanted to alter AAA.BBB, but instead of using a bunch of ALTER
TABLE commands, I did what I always do: went to RazorSQL database explorer
tool, right-clicked on AAA.BBB and have the tool generate the table's DDL.
That resulted in DDL#2.
4. Here I'd normally edit DDL #2, but in this case I did not; I was just
trying to duplicate the problem.
5. I dropped AAA.BBB and re-created it by executing DDL #2.
6. I ran my Java+Hibernate program again, and now it started throwing a
bunch of HibernateExceptions saying that ID can not be null. I know it can
not be null, but it did not have this problem before, because, with the
table created using DDL#1, it knew better than to set ID to null; with DDL
#2, it did not.
That's it.. I did not provide all the gory details earlier because I don't
think it's a hibernate issue... My point is, DDL#1 and DDL#2 are not
providing identical results. I wonder, is that a bug in H2, or is my
RazorSQL giving me a wrong DDL for the table? Are these two scripts supposed
to provide identical results in the first place?
Thank you, I really appreciate your time answering this.
On Tue, Oct 20, 2009 at 10:23 AM, Thomas Mueller <
[email protected]> wrote:
>
> Hi,
>
> > This one (reverse-engineered by my RazorSQL db browser tool) results in
> an
> > exception:
> >
> > CREATE TABLE AAA.BBB (
> > ID BIGINT DEFAULT (NEXT VALUE FOR
> > AAA.SYSTEM_SEQUENCE_66AF15AC_D4EC_4026_AD7B_D8DDA1EA6493) NOT NULL,
> > SITE VARCHAR(16),
> > PRIMARY KEY (ID)
> > );
> >
> > My guess it's probably the tool's fault; but what is it missing?
>
> I don't understand the question, sorry. Who runs this statement and
> why? What exception do you get and from where?
>
> Regards,
> Thomas
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---