The quotes force case-sensitivity on the table and column names.
Without the quotes, the database will figure out the names by
itself, with the quotes, you must be precise.
That should just mean a change in the DTD.
Nathan
-----Original Message-----
From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 24, 2001 8:28 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] postgres and quotes in a query
Hey list,
I'm trying to run the example that is on the JBoss site
(http://www.jboss.org/jboss-castor.jsp) but have found something weird.
Firstly, specs:
JBoss 2.4.0 final
Castor 0.9.3
Postgres 7.1.2
The problem I gets is that the oql query:
SELECT p FROM rooms.dao.RoomData p
is translated to
SELECT "Room"."name","Room"."description","Occupant"."name"
FROM "Room" LEFT OUTER JOIN
"Occupant" ON "Room"."name"="Occupant"."Roomname"
and Postgres complains it cant find the Room Relation... I can confirm
this through psql. However, if I change the query and remove the quotes,
so its:
SELECT Room.name,Room.description,Occupant.name
FROM Room LEFT OUTER JOIN
Occupant ON Room.name=Occupant.Roomname;
then it works fine. Has anyone else experienced this? I'm guessing its
something wrong with my config, so I've included it below. I have looked,
and couldn't find anything obvious or on the site... if there is something
there, a simple pointer would be fine (o:
cheesr
dim
database.xml:
-------------
<database name="rooms" engine="postgresql">
<jndi name="java:/DefaultDS" />
<mapping href="../tomcat/mapping.xml" />
</database>
mapping.xml
-----------
<!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"http://castor.exolab.org/mapping.dtd">
<mapping>
<!-- Mapping for Room -->
<class name="rooms.dao.RoomData" identity="name" >
<cache-type type="unlimited" />
<description>A space that can be occupied</description>
<map-to table="Room" xml="Room" />
<field name="name" type="string">
<sql name="name" type="varchar"/>
<xml name="name" node="element" />
</field>
<field name="description" type="string">
<sql name="description" type="varchar"/>
<xml name="description" node="element" />
</field>
<field
name="OccupantInfo" type="rooms.dao.OccupantData" required="false"
collection="arraylist">
<sql many-key="Roomname"/>
<xml name="Occupant" node="element" />
</field>
</class>
<!-- Mapping for Occupant -->
<class
name="rooms.dao.OccupantData" identity="name" depends="rooms.dao.RoomData">
<cache-type type="unlimited" />
<description>It's an occupant of a room</description>
<map-to table="Occupant" xml="Occupant" />
<field name="name" type="string">
<sql name="name" type="varchar"/>
<xml name="name" node="element" />
</field>
<field name="age" type="integer">
<sql name="age" type="integer"/>
<xml name="age" node="element" />
</field>
<field name="description" type="string">
<sql name="description" type="varchar"/>
<xml name="description" node="element" />
</field>
<field name="Room" type="rooms.dao.RoomData" required="true" >
<sql name="Roomname" />
<xml name="Room" node="element" />
</field>
</class>
</mapping>
castor.properties
-----------------
# Defines the default XML parser to be used by castor
# The parser must implement org.xml.sax.Parser
#
org.exolab.castor.parser=org.apache.xerces.parsers.SAXParser
# Defines the default XML serializer to be used by castor
# The serializer must implement org.apache.xml.serialize.Serializer
#
org.exolab.castor.serializer=org.apache.xml.serialize.XMLSerializer
# Defines the Regular Expression Evaluator to be used by Castor
# The evaluator must implement org.exolab.castor.util.RegExpEvaluator
#
# An implementation which uses the Jakarta RE library
org.exolab.castor.regexp=org.exolab.castor.util.JakartaRegExpEvaluator
#
# Uncomment the following to basically supress evaluation of Regular
expressions
#org.exolab.castor.regexp=org.exolab.castor.xml.util.AlwaysTrueRegExpEvaluat
or
# True if all documents should be indented on output by default
#
org.exolab.castor.indent=true
# True if xml documents should be validated by the SAX Parser
#
org.exolab.castor.parser.validation=false
org.exolab.castor.parser.namespaces=false
# True if all documents should be validated by the marshalling framework
#
org.exolab.castor.marshalling.validation=true
# Comma separated list of SAX 2 features that should be enabled
# for the default parser.
#
#org.exolab.castor.features=
# True if should produce verbose messages
#
org.exolab.castor.debug=false
# List of collection handlers for Java 1.1 and Java 1.2 run-times
#
org.exolab.castor.mapping.collections=\
org.exolab.castor.mapping.loader.J1CollectionHandlers,\
org.exolab.castor.mapping.loader.J2CollectionHandlers
# List of persistence factories for the supported database servers
#
org.exolab.castor.jdo.engines=\
org.exolab.castor.jdo.drivers.OracleFactory,\
org.exolab.castor.jdo.drivers.PostgreSQLFactory,\
org.exolab.castor.jdo.drivers.SybaseFactory,\
org.exolab.castor.jdo.drivers.SQLServerFactory,\
org.exolab.castor.jdo.drivers.DB2Factory,\
org.exolab.castor.jdo.drivers.InformixFactory,\
org.exolab.castor.jdo.drivers.HsqlFactory,\
org.exolab.castor.jdo.drivers.InstantDBFactory,\
org.exolab.castor.jdo.drivers.InterbaseFactory,\
org.exolab.castor.jdo.drivers.MySQLFactory,\
org.exolab.castor.jdo.drivers.GenericFactory
# List of key generator factories
#
org.exolab.castor.jdo.keyGeneratorFactories=\
org.exolab.castor.jdo.drivers.MaxKeyGeneratorFactory,\
org.exolab.castor.jdo.drivers.HighLowKeyGeneratorFactory,\
org.exolab.castor.jdo.drivers.IdentityKeyGeneratorFactory,\
org.exolab.castor.jdo.drivers.SequenceKeyGeneratorFactory,\
org.exolab.castor.jdo.drivers.UUIDKeyGeneratorFactory
# Collection handlers for the source code generator
#
org.exolab.castor.builder.type.j2=\
org.exolab.castor.builder.FieldInfoFactoryJ2
org.exolab.castor.builder.type.j1=\
org.exolab.castor.builder.FieldInfoFactory
org.exolab.castor.builder.type.odmg=\
org.exolab.castor.builder.FieldInfoFactoryODMG30
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev