-
15. Re: Mapping Entity Beans to Database Tables
aloubyansky Jun 5, 2004 4:50 AM (in response to abcolson)The lower case should not cause any problems as the driver must have supported it. This check is done in the org.jboss.ejb.plugins.cmp.jdbc.SQLUtil.
-
16. Re: Mapping Entity Beans to Database Tables
abcolson Jun 6, 2004 6:19 PM (in response to abcolson)Hi loubyansky,
The lower case should not cause any problems as the driver must have supported it. This check is done in the org.jboss.ejb.plugins.cmp.jdbc.SQLUtil.
I am u nclear as to what driver you are referring to: jboss driver or postgresql driver?
As a point of information, postgresql is case sensitive. So, if jboss/cmp is casting data to lowercase, this is a problem. And, it does appear to do this. Consider the following debug trace:2004-06-03 22:44:36,743 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] SQL: SELECT id FROM "questions" WHERE id=?
I think this is the actual SQL getting passed to PostgreSQL. Maybe there is a cmp flag or some mechanism to instruct it not to do this. I am currently researching this.
Do you have any further input or ideas?
Thanks
Tony -
17. Re: Mapping Entity Beans to Database Tables
aloubyansky Jun 7, 2004 1:21 PM (in response to abcolson)We just didn't support quoted table names. There is a method in org.jboss.ejb.plugins.cmp.jdbc.SQLUtil.fixTableName() which fixes the table name according to the database metadata reported by the driver. One of the checks is
/** Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in lower case? */ java.sql.DatabaseMetaData.storesLowerCaseIdentifiers()
which is the answer to your question.
Quoted table names are not fixed now. This is the diff. This is committed to 3.2.4RC2 and HEAD.RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/SQLUtil.java,v retrieving revision 1.12.4.22 diff -r1.12.4.22 SQLUtil.java 100a101,107 > // don't fix the quited table name > char firstChar = tableName.charAt(0); > if(firstChar == '"' || firstChar == '\'') > { > return tableName; > } >
-
18. Re: Mapping Entity Beans to Database Tables
abcolson Jun 8, 2004 1:25 AM (in response to abcolson)Hi loubyansky,
Thanks for your input. This is helpful. 2 questions:
1) What is the relationship between these 2 code segments (i.e. do they interact with each other)?
2) What approach do you suggest: a) Finding a better database driver, b) Download/Compile JBoss 3.2.4RC2?
I think option 2 seems to be the better choice, although more work. I have used the PostgresQL drivers with other programs (i.e. dbadmin) and didn't have problems, so I am skeptical about finding a better driver.
Also, are you a JBoss developer? You seem to be very knowledgable. If so, do you know when 3.2.4 will be released with the fix?
Thanks
Tony -
19. Re: Mapping Entity Beans to Database Tables
aloubyansky Jun 8, 2004 4:21 AM (in response to abcolson)It occurs the 3.2.4 has already been released and the fix is not there. So, you could try to apply it yourself. Have a look at SQLUtil.fixTableName().
If you have to use table names with spaces, I think, you have no other choice but quote them. So, you should fix the fixTableName() method. If you can use table names w/o quotes, just remove the quotes and there shouldn't be a problem. -
20. Re: Mapping Entity Beans to Database Tables
abcolson Jun 9, 2004 2:42 AM (in response to abcolson)Hi Alexey,
Thanks alot. I downloaded the HEAD branch of JBoss-3.2 from sourceforge (I assume this is correct) and verified that the SQLUtil.fixTableName() function has the fix for the quotes.
However, there appears to be an error with the build and I didn't see any documentation or a README file. I know this is starting to get off topic so either I can post to another forum or if you like you could give me alternative contact information for yourself.
But quickly, it appears that the directories are not set up correctly. Specifically, there seems to be a '-' character instead of a '\' character when looking for directories like apache-tomcat41, beanshell-beanshell, etc. Granted I am only about beginner-intermediate with ant, but this seemed strange. Here is the short log when I typed build.bat:configure: Caught exception (org.apache.tools.ant.BuildException) while expanding apache.tomcat41.classpath: C:\jboss-3.2.4\jboss-3.2\thirdparty\apache-tomcat41 not found. Caught exception (org.apache.tools.ant.BuildException) while expanding apache.tomcat50.classpath: C:\jboss-3.2.4\jboss-3.2\thirdparty\apache-tomcat50 not found. Caught exception (org.apache.tools.ant.BuildException) while expanding beanshell.beanshell.classpath: C:\jboss-3.2.4\jboss-3.2\thirdparty\beanshell-beanshell\lib not found. Caught exception (org.apache.tools.ant.BuildException) while expanding jfreechart.jfreechart.classpath: C:\jboss-3.2.4\jboss-3.2\thirdparty\jfreechart\lib not found. [echo] groups: default [echo] modules: common,jmx,system,naming,aop,j2ee,remoting,transaction,server,security,messaging,connector,cluster,varia,webservice,iiop,management,cache,tomcat,console,compatibility,aspects,media init: _buildmagic:modules:most: ====================================================================== == Executing 'most' in module 'common'... == _buildmagic:init: configure: Caught exception (org.apache.tools.ant.BuildException) while expanding apache.tomcat41.classpath: C:\jboss-3.2.4\jboss-3.2\thirdparty\apache-tomcat41 not found. Caught exception (org.apache.tools.ant.BuildException) while expanding apache.tomcat50.classpath: C:\jboss-3.2.4\jboss-3.2\thirdparty\apache-tomcat50 not found. Caught exception (org.apache.tools.ant.BuildException) while expanding beanshell.beanshell.classpath: C:\jboss-3.2.4\jboss-3.2\thirdparty\beanshell-beanshell\lib not found. Caught exception (org.apache.tools.ant.BuildException) while expanding jfreechart.jfreechart.classpath: C:\jboss-3.2.4\jboss-3.2\thirdparty\jfreechart\lib not found. _default:task-init: init: _buildmagic:build-bypass-checker: _buildmagic:build-bypass-notice: _buildmagic:build-bypass-check: jars: _buildmagic:init: init: _buildmagic:mbean-bypass-checker: _default:compile-mbean-sources: BUILD FAILED file:C:/jboss-3.2.4/jboss-3.2/common/../tools/etc/buildmagic/buildmagic.ent:439: taskdef class xdoclet.modules.jmx.JMXDocletTask cannot be found at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:236) at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:162) at org.apache.tools.ant.Task.perform(Task.java:341) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:336) at org.apache.tools.ant.Project.executeTarget(Project.java:1339) at org.jboss.tools.buildmagic.task.CallTarget.execute(CallTarget.java:141) at org.apache.tools.ant.Task.perform(Task.java:341) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:336) at org.apache.tools.ant.Project.executeTarget(Project.java:1339) at org.jboss.tools.buildmagic.task.Ant.execute(Ant.java:261) at org.jboss.tools.buildmagic.task.module.ExecuteModules$1.run(ExecuteModules.java:361) at org.jboss.tools.buildmagic.task.module.ExecuteModules.executeModule(ExecuteModules.java:376) at org.jboss.tools.buildmagic.task.module.ExecuteModules.execute(ExecuteModules.java:241) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193) at org.apache.tools.ant.Task.perform(Task.java:341) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:336) at org.apache.tools.ant.Project.executeTarget(Project.java:1339) at org.apache.tools.ant.Project.executeTargets(Project.java:1255) at org.apache.tools.ant.Main.runBuild(Main.java:609) at org.apache.tools.ant.Main.start(Main.java:196) at org.apache.tools.ant.Main.main(Main.java:235) Caused by: java.lang.ClassNotFoundException: xdoclet.modules.jmx.JMXDocletTask at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1075) at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1036) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:925) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:230) ... 23 more --- Nested Exception --- java.lang.ClassNotFoundException: xdoclet.modules.jmx.JMXDocletTask at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1075) at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1036) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:925) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:230) at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:162) at org.apache.tools.ant.Task.perform(Task.java:341) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:336) at org.apache.tools.ant.Project.executeTarget(Project.java:1339) at org.jboss.tools.buildmagic.task.CallTarget.execute(CallTarget.java:141) at org.apache.tools.ant.Task.perform(Task.java:341) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:336) at org.apache.tools.ant.Project.executeTarget(Project.java:1339) at org.jboss.tools.buildmagic.task.Ant.execute(Ant.java:261) at org.jboss.tools.buildmagic.task.module.ExecuteModules$1.run(ExecuteModules.java:361) at org.jboss.tools.buildmagic.task.module.ExecuteModules.executeModule(ExecuteModules.java:376) at org.jboss.tools.buildmagic.task.module.ExecuteModules.execute(ExecuteModules.java:241) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193) at org.apache.tools.ant.Task.perform(Task.java:341) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:336) at org.apache.tools.ant.Project.executeTarget(Project.java:1339) at org.apache.tools.ant.Project.executeTargets(Project.java:1255) at org.apache.tools.ant.Main.runBuild(Main.java:609) at org.apache.tools.ant.Main.start(Main.java:196) at org.apache.tools.ant.Main.main(Main.java:235)
Thanks Alexey,
Tony -
21. Re: Mapping Entity Beans to Database Tables
aloubyansky Jun 9, 2004 4:34 AM (in response to abcolson)Have you checked it out with the
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/jboss co -r Branch_3_2 jboss-3.2
CVS instructions are here http://www.jboss.org/developers/sourcecode -
22. Re: Mapping Entity Beans to Database Tables
abcolson Jun 13, 2004 12:02 AM (in response to abcolson)Hi Alexey,
It worked. The JBoss version 3.2.4RC1 does fix the quote problem and my database test application works as expected.
Thanks to all who helped me.
Alexey, email me at info@tpfunding.com. I have something I would like to tell you privately.
Cheers Everybody