[ circumflex-orm ] Table not found error.

63 views
Skip to first unread message

missingfaktor

unread,
Apr 27, 2012, 7:46:03 AM4/27/12
to Circumflex Public Q&A, missin...@gmail.com
Hello, everyone.

I am using circumflex-orm 2.1 with mysql. Following are the contents
of my "cx.properties" file:

orm.connection.driver=com.mysql.jdbc.Driver
orm.connection.url=jdbc:mysql://localhost:3306/snarkdb
orm.connection.username=username
orm.connection.password=password
orm.defaultSchema=snarkdb

I have written a test case similar to the one here:
https://github.com/inca/circumflex/blob/master/circumflex-orm/src/test/scala/specs.scala.
The individual test cases do not contain any important stuff yet, and
my loadData method is slightly different:

def loadData: Unit = {
try {
val configAsXml = XML.loadFile("src/test/resources/
test.cxd.xml")
Deployment.readAll(configAsXml).foreach(_.process)
} catch {
case ex: Exception => {
logger.error("XML config reading failed.", ex)
throw ex
}
}
}

The line where XML is loaded works fine, however the Deployment line
throws an exception and the following log is printed:

16:37:56.270 [Outgoing Connection [1dfc74f5-c1d1-41a0-
adc7-2d5a842376c8 port:52080, addresses:[/0:0:0:0:0:0:0:1, /
127.0.0.1]]:0 worker] INFO ru.circumflex.orm - Using READ COMMITTED
isolation, override 'orm.connection.isolation' if necesssary.
16:37:56.287 [Outgoing Connection [1dfc74f5-c1d1-41a0-
adc7-2d5a842376c8 port:52080, addresses:[/0:0:0:0:0:0:0:1, /
127.0.0.1]]:0 worker] INFO ru.circumflex.orm - Using c3p0 connection
pool.
16:37:57.479 [Outgoing Connection [1dfc74f5-c1d1-41a0-
adc7-2d5a842376c8 port:52080, addresses:[/0:0:0:0:0:0:0:1, /
127.0.0.1]]:0 worker] DEBUG ru.circumflex.orm - CREATE TABLE profile
(name TEXT NOT NULL, PRIMARY KEY (name))
16:37:57.571 [Outgoing Connection [1dfc74f5-c1d1-41a0-
adc7-2d5a842376c8 port:52080, addresses:[/0:0:0:0:0:0:0:1, /
127.0.0.1]]:0 worker] DEBUG ru.circumflex.orm - CREATE TABLE bundle
(version TEXT NOT NULL, profile TEXT NOT NULL, PRIMARY KEY (version))
16:37:57.576 [Outgoing Connection [1dfc74f5-c1d1-41a0-
adc7-2d5a842376c8 port:52080, addresses:[/0:0:0:0:0:0:0:1, /
127.0.0.1]]:0 worker] DEBUG ru.circumflex.orm - CREATE TABLE archive
(id TEXT NOT NULL, name TEXT NOT NULL, type TEXT NOT NULL, group TEXT
NOT NULL, version TEXT NOT NULL, bundle TEXT NOT NULL, PRIMARY KEY
(id))
16:37:57.581 [Outgoing Connection [1dfc74f5-c1d1-41a0-
adc7-2d5a842376c8 port:52080, addresses:[/0:0:0:0:0:0:0:1, /
127.0.0.1]]:0 worker] DEBUG ru.circumflex.orm - ALTER TABLE bundle ADD
CONSTRAINT bundle_profile_fkey FOREIGN KEY (profile) REFERENCES
profile (name) ON DELETE CASCADE ON UPDATE CASCADE
16:37:57.585 [Outgoing Connection [1dfc74f5-c1d1-41a0-
adc7-2d5a842376c8 port:52080, addresses:[/0:0:0:0:0:0:0:1, /
127.0.0.1]]:0 worker] DEBUG ru.circumflex.orm - ALTER TABLE archive
ADD CONSTRAINT archive_bundle_fkey FOREIGN KEY (bundle) REFERENCES
bundle (version) ON DELETE CASCADE ON UPDATE CASCADE
16:37:57.881 [Outgoing Connection [1dfc74f5-c1d1-41a0-
adc7-2d5a842376c8 port:52080, addresses:[/0:0:0:0:0:0:0:1, /
127.0.0.1]]:0 worker] DEBUG ru.circumflex.orm - SELECT root.name AS
p_1 FROM profile AS root WHERE root.name = ?
16:37:57.913 [Outgoing Connection [1dfc74f5-c1d1-41a0-
adc7-2d5a842376c8 port:52080, addresses:[/0:0:0:0:0:0:0:1, /
127.0.0.1]]:0 worker] ERROR in.vayana.snark.Sample$ - XML config
reading failed.
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table
'snarkdb.profile' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method) ~[na:1.6.0_24]
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39) ~[na:1.6.0_24]
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
27) ~[na:1.6.0_24]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
~[na:1.6.0_24]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-
connector-java-5.1.19.jar:na]
at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-
java-5.1.19.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
~[mysql-connector-java-5.1.19.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4098) ~[mysql-
connector-java-5.1.19.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4030) ~[mysql-
connector-java-5.1.19.jar:na]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) ~[mysql-
connector-java-5.1.19.jar:na]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) ~[mysql-
connector-java-5.1.19.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677)
~[mysql-connector-java-5.1.19.jar:na]
at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:
2134) ~[mysql-connector-java-5.1.19.jar:na]
at
com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:
2300) ~[mysql-connector-java-5.1.19.jar:na]
at
com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:
76) ~[c3p0-0.9.1.2.jar:0.9.1.2]
at ru.circumflex.orm.SQLQuery$$anonfun$2$$anonfun$apply
$1.apply(query.scala:100) ~[circumflex-orm-2.1.jar:na]
at ru.circumflex.orm.SQLQuery$$anonfun$2$$anonfun$apply
$1.apply(query.scala:98) ~[circumflex-orm-2.1.jar:na]
at ru.circumflex.orm.Transaction$$anonfun$execute
$1.apply(config.scala:282) ~[circumflex-orm-2.1.jar:na]
at ru.circumflex.orm.Transaction$$anonfun$execute
$1.apply(config.scala:275) ~[circumflex-orm-2.1.jar:na]
at ru.circumflex.orm.Transaction.execute(config.scala:264)
~[circumflex-orm-2.1.jar:na]
at ru.circumflex.orm.Transaction.execute(config.scala:275)
~[circumflex-orm-2.1.jar:na]
at ru.circumflex.orm.SQLQuery$$anonfun$2.apply(query.scala:98)
~[circumflex-orm-2.1.jar:na]
at ru.circumflex.core.package$.time(package.scala:28) ~[circumflex-
core-2.1.jar:na]
at ru.circumflex.orm.SQLQuery.resultSet(query.scala:97) ~[circumflex-
orm-2.1.jar:na]
at ru.circumflex.orm.Criteria.unique(criteria.scala:217) ~[circumflex-
orm-2.1.jar:na]
at ru.circumflex.orm.Deployment.processNode(xml.scala:56)
~[circumflex-orm-2.1.jar:na]
at ru.circumflex.orm.Deployment$$anonfun$process$1.apply(xml.scala:
38) ~[circumflex-orm-2.1.jar:na]
at ru.circumflex.orm.Deployment$$anonfun$process$1.apply(xml.scala:
38) ~[circumflex-orm-2.1.jar:na]
at scala.collection.LinearSeqOptimized
$class.foreach(LinearSeqOptimized.scala:59) ~[gryphon-scala-0.0.1-
SNAPSHOT.jar:na]
at scala.collection.immutable.List.foreach(List.scala:45) ~[gryphon-
scala-0.0.1-SNAPSHOT.jar:na]
at ru.circumflex.orm.Deployment.process(xml.scala:38) ~[circumflex-
orm-2.1.jar:na]
at in.vayana.snark.Sample$$anonfun$loadData
$1.apply(PersistenceTest.scala:25) ~[test/:na]
at in.vayana.snark.Sample$$anonfun$loadData
$1.apply(PersistenceTest.scala:25) ~[test/:na]
at scala.collection.LinearSeqOptimized
$class.foreach(LinearSeqOptimized.scala:59) ~[gryphon-scala-0.0.1-
SNAPSHOT.jar:na]
at scala.collection.immutable.List.foreach(List.scala:45) ~[gryphon-
scala-0.0.1-SNAPSHOT.jar:na]
at in.vayana.snark.Sample$.loadData(PersistenceTest.scala:25)
~[test/:na]
at in.vayana.snark.PersistenceTest$$anonfun$1.apply$mcV
$sp(PersistenceTest.scala:45) [test/:na]
at in.vayana.snark.PersistenceTest$$anonfun
$1.apply(PersistenceTest.scala:43) [test/:na]
at in.vayana.snark.PersistenceTest$$anonfun
$1.apply(PersistenceTest.scala:43) [test/:na]

Log suggests that the tables are created, however Deployment line
cannot find the table. What is it that am I doing wrong here? Please
help. Thank you.

Rahul.

Boris Okunskiy

unread,
May 3, 2012, 3:23:31 AM5/3/12
to circumfl...@googlegroups.com
Greetings,

Sorry for the late response. The `Deployment` abstraction is only responsible for reading records from XML and persisting them (presumably into existing database schema). If you instantiate your schema manually (i.e. not with Circumflex Maven plugin), then please refer to `DDLUnit` class (http://circumflex.ru/api/2.1/circumflex-orm/src/main/scala/ddl.scala.html)

Best regards,
Boris Okunskiy
Reply all
Reply to author
Forward
0 new messages