[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
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 [EMAIL PROTECTED] I have something I would like to tell you privately. Cheers Everybody View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3838580#3838580 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3838580 --- This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
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:
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
Have you checked it out with the | cvs -d:pserver:[EMAIL PROTECTED]:/cvsroot/jboss co -r Branch_3_2 jboss-3.2 | CVS instructions are here http://www.jboss.org/developers/sourcecode View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3838077#3838077 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3838077 --- This SF.Net email is sponsored by: GNOME Foundation Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event. GNOME Users and Developers European Conference, 28-30th June in Norway http://2004/guadec.org ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
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. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837918#3837918 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837918 --- This SF.Net email is sponsored by: GNOME Foundation Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event. GNOME Users and Developers European Conference, 28-30th June in Norway http://2004/guadec.org ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
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; |} | | View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837793#3837793 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837793 --- This SF.Net email is sponsored by: GNOME Foundation Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event. GNOME Users and Developers European Conference, 28-30th June in Norway http://2004/guadec.org ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
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 View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837897#3837897 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837897 --- This SF.Net email is sponsored by: GNOME Foundation Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event. GNOME Users and Developers European Conference, 28-30th June in Norway http://2004/guadec.org ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
Hi loubyansky, anonymous wrote : 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 View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837691#3837691 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837691 --- This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
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. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837630#3837630 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837630 --- This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
Hi loubyansky, anonymous wrote : So you are missing jbosscmp-jdbc.xml? Good Call! For some reason this wasn't making it in. I put it in and tried it and although it didn't work completely, the generated sql did in fact use the table name questions and not question. But, as you recall from previous posts, the table should be Questions, with a big Q. For some reason, the table name gets converted to lower case. I put quotes in the table name and the quotes do get incorporated into the sql statement, but it still gets converted to lower case. I'll look into the case issue tomorrow and let you know. If you know, please tell me how to do it. Thanks Tony View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837505#3837505 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837505 --- This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
So you are missing jbosscmp-jdbc.xml? View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837319#3837319 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837319 --- This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
I have an imression that the deployment descriptors you post here are not used. How do you package the EJB JAR and what is its contents? View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837170#3837170 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837170 --- This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
Hi loubyansky, anonymous wrote : I have an imression that the deployment descriptors you post here are not used. How do you package the EJB JAR and what is its contents? Interesting idea. I hadn't thought of that. Here is a breakdown jar -tf FiboApp.ear | | META-INF/ | META-INF/MANIFEST.MF | META-INF/application.xml | FiboEJB.jar | FiboWeb.war jar -tf FiboEJB.jar | | META-INF/ | META-INF/MANIFEST.MF | META-INF/ejb-jar.xml | META-INF/jboss.xml | tutorial/ | tutorial/ejb/ | tutorial/ejb/FiboBean.class | tutorial/ejb/QuestionBean.class | tutorial/ejb/QuestionCategoryBean.class | tutorial/interfaces/ | tutorial/interfaces/Fibo.class | tutorial/interfaces/FiboHome.class | tutorial/interfaces/Question.class | tutorial/interfaces/QuestionCategory.class | tutorial/interfaces/QuestionCategoryHome.class | tutorial/interfaces/QuestionHome.class META-INF/ejb-jar.xml looks fine. I checked specifically the abstract-schema-name and it was as I changed it previously to Questions. Do you see anything wrong here? Thanks Tony View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837313#3837313 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837313 --- This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
Hi ironbird, Here's the latest... anonymous wrote : You think that the error is for your questions bean. I think the error is for your QuestionCategory bean. | Try to activate cmp plugin traces to see the generated SQL in jboss log file. The reason I think this is that I am not instantiating a QuestionCategory bean anyplace and I am only instantiating a Question bean once in a test servlet. When I go to that servlet (and after turning on log4j tracing) I get 2004-05-31 22:35:09,054 TRACE [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Resized cache for bean QuestionCategory: old capacity = 100, new capacity = 50 | 2004-05-31 22:35:10,095 TRACE [org.jboss.system.Registry] lookup 1524151178=jboss.j2ee:jndiName=ejb/tutorial/Fibo,service=EJB | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start method=create | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is null | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED for create | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came in with tx null | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Starting new tx TransactionImpl:XidImpl [FormatId=257, GlobalId=pegasus//5, BranchQual=] | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT: In finally | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=create | 2004-05-31 22:35:10,095 TRACE [org.jboss.system.Registry] lookup 102234528=jboss.j2ee:jndiName=ejb/tutorial/Question,service=EJB | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start method=findByPrimaryKey | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is null | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED for findByPrimaryKey | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came in with tx null | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Starting new tx TransactionImpl:XidImpl [FormatId=257, GlobalId=pegasus//7, BranchQual=] | 2004-05-31 22:35:10,105 TRACE [org.jboss.ejb.plugins.EntityInstancePool] Get instance [EMAIL PROTECTED] tutorial.ejb.QuestionBean | 2004-05-31 22:35:10,105 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] Executing SQL: SELECT id FROM question WHERE id=? | 2004-05-31 22:35:10,105 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] Set parameter: index=1, jdbcType=BIGINT, value=1 | 2004-05-31 22:35:10,105 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] Find failed | java.sql.SQLException: ERROR: Relation question does not exist which is what I expected: a PreparedStatement with one parameter. BTW, when I did a grep SELECT server.log I got the following: SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM JMS_TRANSACTIONS | SELECT_MAX_TX = SELECT MAX(TXID) FROM JMS_MESSAGES | SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, ESSAGEBLOB FROM JMS_MESSAGES WHERE DESTINATION=? | SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=? | DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM JMS_MESSAGES WHERE TXID IN (SELECT TXID FROM JMS_TRANSACTIONS) AND TXOP=? 2004-05-31 22:22:21,180 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.QuestionCategory] Entity Exists SQL: SELECT COUNT(*) FROM questioncategory WHERE id=? | 2004-05-31 22:22:21,320 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.QuestionCategory#findByPrimaryKey] SQL: SELECT id FROM questioncategory WHERE id=? | 2004-05-31 22:22:21,340 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Question] Entity Exists SQL: SELECT COUNT(*) FROM question WHERE id=? | 2004-05-31 22:22:21,380 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] SQL: SELECT id FROM question WHERE id=? | 2004-05-31 22:22:55,379 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] Executing SQL: SELECT id FROM question WHERE id=? So maybe some of these other sql statements are causing the problem. anonymous wrote : No, the EJB spec from SUN says that the where clause in EJB-QL must refers to the abstract schema name of your bean, which is QuestionCategory, not QuestionCategoryBean. So your EJB-QL should be | Code: | | SELECT OBJECT(qcb) FROM QuestionCategory qcb WHERE qcb.id = ?1 Well, then there may be two bugs with JBoss 3.2.3: Bug #1 Non Recognition Of abstract-schema-name When I tested without my re-definition of findByPrimaryKey(), I changed Question descriptor in ejb-jar.xml to entity
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
There is no bug wrt abstract-schema-name. The problem is the space in the table name. It should be quoted in queries but it's not. This can be considered as a bug in JBossCMP. While it's not fixed you have to use table names that can be used w/o quotes. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837029#3837029 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837029 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
abcolson, For the abstract schema name, it's your bug, not the container. And it's for the QuestionCategory bean, not the Question bean. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837035#3837035 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837035 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
After looking carefully at your traces, I agree with you. The error concerns the findByprimaryKey on your QuestionBean. And the SQL string refers to a question table which is your bean name. The datasource mapping for the QuestionBean is missing, and the datasource and datasource mapping for the QuestionCategorybean is also missing. Try to specify the datasource mapping to PostgreSQL3 OR PostgreSQL 7.2, depends on your version in the jboss.persistence tag I don't understand you don't have a deployment error. With JBoss 3.2.3, I have a deployment error Error in jbosscmp-jdbc.xml : datasource-mapping not found if I do the same thing. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837042#3837042 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837042 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
Well, I have some news, but I don't know how thrilled I am with it. First, without changing anything WRT my Question bean and descriptors, nor without redeploying, I added a view in my database called question which maps to Questions and maps the fields like category_id to categoryid. The result...it worked. But it seems like a hack. I just spent half the day cursing about Microsoft and now this. There has to be something else we can do, especially since legacy database schemas will not always conform. And with PostgreSQL, quotes are needed to distinguish not only spaces but case, like Questions from questions. Not to mention, BTW, that you can only read from a view, which, of course, is a problem. In response to loubyansky: anonymous wrote : There is no bug wrt abstract-schema-name. The problem is the space in the table name. It should be quoted in queries but it's not. This can be considered as a bug in JBossCMP. While it's not fixed you have to use table names that can be used w/o quotes. Could you please elaborate on distinguishing a bug with abstract-schema-name and JBossCMP? Knowing what I do (which is only at the novice level) I don't see how we can make this distinction with the information at hand, i.e. it is all JBoss to me. Note also that my test case with Question worked without doing anything to QuestionCategory or descriptors, so again I am suspect of this analysis. But if it is a bug with the container, and it is not JBoss's responsibility to fix it, from who and where can I get another one? In response to ironbird: anonymous wrote : I don't understand you don't have a deployment error. With JBoss 3.2.3, I have a deployment error Error in jbosscmp-jdbc.xml : datasource-mapping not found if I do the same thing. | Perhaps it is because of my standardjbosscmp-jdbc.xml file jbosscmp-jdbc | |defaults | datasourcejava:/PostgresDS/datasource | !-- | datasource-mappingHypersonic SQL/datasource-mapping | -- | | datasource-mappingPostgreSQL 7.2/datasource-mapping | | create-tablefalse/create-table | remove-tablefalse/remove-table | read-onlyfalse/read-only | read-time-out30/read-time-out | row-lockingfalse/row-locking | pk-constrainttrue/pk-constraint | fk-constraintfalse/fk-constraint | preferred-relation-mappingforeign-key/preferred-relation-mapping | read-ahead | strategyon-load/strategy | page-size1000/page-size | eager-load-group*/eager-load-group | /read-ahead | list-cache-max1000/list-cache-max | | unknown-pk | key-generator-factoryUUIDKeyGeneratorFactory/key-generator-factory | unknown-pk-classjava.lang.String/unknown-pk-class | jdbc-typeVARCHAR/jdbc-type | sql-typeVARCHAR(32)/sql-type | /unknown-pk | | entity-command name=default/ | |/defaults | |type-mappings | | type-mapping | namePostgreSQL 7.2/name | row-locking-templateSELECT ?1 FROM ?2 WHERE ?3 FOR UPDATE/row-locking-template | pk-constraint-templateCONSTRAINT ?1 PRIMARY KEY (?2)/pk-constraint-template | fk-constraint-templateALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)/fk-constraint-template | auto-increment-template?1/auto-increment-template | alias-header-prefixt/alias-header-prefix | alias-header-suffix_/alias-header-suffix | alias-max-length32/alias-max-length | subquery-supportedtrue/subquery-supported | true-mappingTRUE/true-mapping | false-mappingFALSE/false-mapping | | function-mapping | function-nameconcat/function-name | function-sql(?1 || ?2)/function-sql | /function-mapping | function-mapping | function-namesubstring/function-name | function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql | /function-mapping | etc. | etc. | etc. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837160#3837160 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837160 --- This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
No matter the matching between table names and bean name, or field name and column name, all the mapping is done in jbosscmp-jdbc.xml. I think the problem is the space in your Question Categories. This don't work, even in sql. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3836956#3836956 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3836956 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
Try removing or commenting the from your ejb-jar.xml to rule that out, since it isn't needed for findByPrimaryKey(). It looks OK, but doesn't hurt to rule it out since this is a needle in a haystack. I'm wondering why it's looking for a relation. That seems really odd since you didn't define any relationships. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3836984#3836984 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3836984 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
I don't know which findByPrimaryKey throws an error, but the second one (for QuestionCategory bean) has an error. Your bean abstract schema name is QuestionCategory not QuestionCategorybean. It's surprising you have no errors at deployment. But as says Erik, you can remove both. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3836988#3836988 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3836988 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
Thanks for the feedback, guys. But I am not sure I understand your recommendations. anonymous wrote : Try removing or commenting the from your ejb-jar.xml to rule that out, since it isn't needed for findByPrimaryKey(). I think maybe all the words didn't come through. I am unclear on what exactly you suggest removing. anonymous wrote : I'm wondering why it's looking for a relation. That seems really odd since you didn't define any relationships. | I think this might be a slip in terminology. It appears to be either a PostgresQL message or a java message i.e. java.sql.SQLException: ERROR: Relation question does not exist BTW, when I create a view called question which is simply a SELECT * FROM Questions the table is mapped but then I get field mapping errors (makes sense if it is the same mapping pattern problem) anonymous wrote : I think the problem is the space in your Question Categories. This don't work, even in sql. I don't think this is the problem. PostgresQL seems to be case sensitive and translates everything you type in a sql statement to lowercase unless you put it in quotes. Same goes for spaces. So in PostgresQL, SELECT * FROM Question Categories works fine. At some point I need to investigate the quoting issue, but I can't do that as long as JBoss keeps looking for question and not questions. anonymous wrote : Your bean abstract schema name is QuestionCategory not QuestionCategorybean. | It's surprising you have no errors at deployment. | Do you mean QuestionCategoryBean (upper case B)? Actually, I am using XDoclet to generate the descriptors and this is what it generates by default. Do I really need to alter this? I am actually confused on what abstract-schema-name is used for so I can't comment on the issue of no deployment errors regarding abstract schema names. I did try changing the schema in my Question example to QuestionBean and that didn't seem to help. Here are the XDoclet headers for my 2 cases: QuestionBean: /** | * @author colson | * | * @ejb.bean name=Question | * display-name = Question EJB | * description = EJB that manages a Question | * view-type = remote | * jndi-name = ejb/tutorial/Question | * cmp-version = 2.x | * primkey-field = id | * | * @ejb.persistence table-name = Questions | * | * @ejb.finderdescription = Lookup Question By ID | *signature = tutorial.interfaces.Question findByPrimaryKey(java.lang.Long) | *result-type-mapping = Local | *query = SELECT OBJECT(qb) FROM QuestionBean qb WHERE qb.id = ?1 | * | * @ejb.resource-refres-ref-name = jdbc/PostgresDS | * res-type = javax.sql.DataSource | * res-auth = Container | * | * @jboss.resource-ref res-ref-name = jdbc/PostgresDS | * jndi-name = java:/PostgresDS | * | * @jboss.persistence table-name = Questions | *datasource = java:/PostgresDS | * | * To change the template for this generated type comment go to | * WindowPreferencesJavaCode GenerationCode and Comments | */ | QuestionCategoryBean: /** | * @author colson | * | * | * @ejb.bean name=QuestionCategory | * display-name = Question Category EJB | * description = EJB that manages a Question Category | * view-type = remote | * jndi-name = ejb/tutorial/QuestionCategory | * cmp-version = 2.x | * primkey-field = id | * | * @ejb.persistence table-name = Question Categories | * | * | * | * @ejb.finderdescription = Lookup Question Category By ID | *signature = tutorial.interfaces.QuestionCategory findByPrimaryKey(java.lang.Long) | *result-type-mapping = Local | *query = SELECT OBJECT(qcb) FROM QuestionCategoryBean qcb WHERE qcb.id = ?1 | * | * @ejb.resource-refres-ref-name = jdbc/PostgresDS | * res-type = javax.sql.DataSource | * res-auth = Container | * | * @jboss.resource-ref res-ref-name = jdbc/PostgresDS | * jndi-name = java:/PostgresDS | * | * | * | * To change the template for this generated type comment go to | * WindowPreferencesJavaCode GenerationCode and Comments | */ | Thanks for all the tips! Tony View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3836999#3836999 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3836999 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g
[JBoss-user] [Persistence CMP/JBoss] - Re: Mapping Entity Beans to Database Tables
anonymous wrote : | I think maybe all the words didn't come through. I am unclear on what exactly you suggest removing. | You don't need to define the findByPrimarykey finder. The container knows how to implement it. anonymous wrote : | I think this might be a slip in terminology. It appears to be either a PostgresQL message or a java message i.e. | | BTW, when I create a view called question which is simply a SELECT * FROM Questions the table is mapped but then I get field mapping errors (makes sense if it is the same mapping pattern problem) | The only term in your code where question is referenced is your entity bean name (and it has nothing to do with an SQL string) and your table name Question Categories (which has to do with sql string). The error log talks about a relation but there is no relation in your descriptor snippets. So the error text is useless. anonymous wrote : | I don't think this is the problem. PostgresQL seems to be case sensitive and translates everything you type in a sql statement to lowercase unless you put it in quotes. Same goes for spaces. So in PostgresQL, | SELECT * FROM Question Categories works fine. | I agree with you for the database, but when I try myself on my computer, the container don't put the quotes and throws an error. anonymous wrote : | Do you mean QuestionCategoryBean (upper case B)? | No, the EJB spec from SUN says that the where clause in EJB-QL must refers to the abstract schema name of your bean, which is QuestionCategory, not QuestionCategoryBean. So your EJB-QL should be | SELECT OBJECT(qcb) FROM QuestionCategory qcb WHERE qcb.id = ?1 | You think that the error is for your questions bean. I think the error is for your QuestionCategory bean. Try to activate cmp plugin traces to see the generated SQL in jboss log file. Add | category name=org.jboss.ejb.plugins | priority value=TRACE class=org.jboss.logging.XLevel/ | /category | in Log4j.xml View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3837004#3837004 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3837004 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user