cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr.abanjo <mr.aba...@gmail.com>
Subject DB Generation
Date Wed, 14 Jan 2009 13:46:49 GMT
Hi,i have configured a simple cayenne datamap for my application with 2
table.
All works fine, i can read/write into them without problem.

Now, i want to create at runtime the database schema, so if is the first
time and the database is empty i can generate it on the fly.
I do it with this code (taken from petstore sample in cayenne's wiki):


      DataDomain domain =
Configuration.getSharedConfiguration().getDomain();

      DataNode node = getDataNode(domain);
      DbGenerator generator = new DbGenerator(node.getAdapter(),
getDataMap(domain));
      try {
        generator.runGenerator(node.getDataSource());
      } catch (Exception e) {
        throw new Exception("Error generating DB schema", e);
      }

If i test this code on a HSQLDB it works well.
The strange thing is that after execution i have 3 tables instead of 2...
infact there is also "AUTO_PK_SUPPORT" that i haven't defined in my datamap.
I suppose that it is a table used by canyenne.

But if i test it on MYSQL db it doesn't work.
ONLY the "AUTO_PK_SUPPORT" is created.

Anyone have idea why the same code works in 2 different way?

The user that i use to connect to mysql haves all privileges.


Thanks
Davide

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message