[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships
I can find the DataSource on the java namespace... anonymous wrote : | JMX MBean Operation Result | | . | . | . | | | java: Namespace | +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory) | +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource) | +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory) | +- DefaultJMSProvider (class: org.jboss.jms.jndi.JBossMQProvider) | +- MySqlDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource) | +- comp (class: javax.naming.Context) | +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl) | +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory) | +- jaas (class: javax.naming.Context) | | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext) | | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext) | | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext) | +- timedCacheFactory (class: javax.naming.Context) | Failed to lookup: timedCacheFactory, errmsg=null | +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory) | +- Mail (class: javax.mail.Session) | +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory) | +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter) | +- TransactionManager (class: org.jboss.tm.TxManager) | | . | . | . | View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840953#3840953 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840953 --- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships
O i can't believe it! It's a stupid error! I have: | | java:/mySqlDS | mySQL | foreign-key | false | false | | and my datasource is MySqlDS. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840956#3840956 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840956 --- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships
The datasource is not available. Make sure it is deployed successfully and you can see it in JNDIView. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840846#3840846 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840846 --- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships
Sorry. Here are the deployment descriptors | | . | . | . | | | | person-card | | person | PersonRole | One | | person | Person | | | card | card | java.util.Collection | | | | card | CardRole | Many | | | card | Card | | | | | | | | | | | | java:/mySqlDS | mySQL | foreign-key | false | false | | | . | . | . | | | | person-card | | | PersonRole | | | CardRole | | | | Thanks. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840773#3840773 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840773 --- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships
Post deployment descriptors etc. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840771#3840771 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840771 --- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships and Foreign Keys
I agree with you warmachine, I just don't use myself database created by JBoss, but with a standard modeling tool from Sybase, so I don't experiment this problem. As you says, it is not a good way to lets Jboss create foreign keys itself with a standard relationship persistance method. So there is no restriction to declare the foreign key as an additional CMP field. Just do not use the same field name. Concerning the error, TransType is the remote class. For CMR fields, you must use the local interface, not the remote. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830131#3830131 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830131 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships and Foreign Keys
I'm working with mpforste on this problem. Only having tr_type (the foreign key) as a cmr-field means when JBoss creates the table in mySQL, the foreign key field is a BLOB. The foreign key is supposed to be a BIGINT and creating transactions fails when it is a BIGINT. When I leave it as a BLOB, code works as I expected, including creating a transaction with a transtype object, retrieving an associated transtype from a transaction and setting its description, which appears in the transtype table. In other words, we have CMR but using an object reference, not a foreign key field. Surely this can't be JBoss's method of persisting relationships? It can't be made to use a relational model or have I misconfigured something? I would prefer to use a relational persistence scheme so other reporting tools can read the database. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830119#3830119 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830119 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships and Foreign Keys
Now I am getting this errror when trying to call the create function, 13:44:41,220 ERROR [LogInterceptor] EJBException, causedBy: java.lang.ClassCastException at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceV alue(JDBCCMRFieldBridge.java:773) at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JDB CCMRFieldBridge.java:624) at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke (EntityBridgeInvocationHandler.java:121) at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59) at com.ingotz.points.core.entity.TransactionBean$Proxy.setTr_type() at com.ingotz.points.core.entity.TransactionBean.ejbPostCreate(Unknown S ource) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.plugins.CMPPersistenceManager.postCreateEntity(CMPPersi stenceManager.java:240) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.post CreateEntity(CachedConnectionInterceptor.java:277) at org.jboss.ejb.EntityContainer.postCreateHome(EntityContainer.java:725 ) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityConta The line that causes the problem is as follows (in a JSP file) Transaction tranMan = tran.create(new Date(),new Integer(1),new Boolean(false), new Boolean(false),transtype); The TransactionHome Create function is as follows public Transaction create( Date tr_date, Integer tr_state, Boolean tr_summary, Boolean tr_non_refundable, TransType tr_type ) throws RemoteException, CreateException; The ejbcreate code is as follows public Long ejbCreate( Date tr_date, Integer tr_state, Boolean tr_summary, Boolean tr_non_refundable, TransType tr_type) throws CreateException { setTr_date(tr_date); setTr_state(tr_state); setTr_summary(tr_summary); setTr_non_refundable(tr_non_refundable); return null; } public void ejbPostCreate(Date tr_date, Integer tr_state, Boolean tr_summary, Boolean tr_non_refundable, TransType tr_type ) throws CreateException { setTr_type(tr_type); } View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830114#3830114 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830114 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships and Foreign Keys
Sorry, I made a mistake in the previous jbosscmp-jdbc.xml: It shoul be: | | | Type-Transaction | | | TransTypeBeanEnd | | | id | tr_type | | | | | TransactionBeanEnd | | | | | and ejb-jar.xml : | | TransTypeBean | com.ingotz.entity.TransTypeHome | com.ingotz.entity.TransType | com.ingotz.entity.TransTypeLocalHome | com.ingotz.entity.TransTypeLocal | com.ingotz.entity.TransTypeBean | Container | java.lang.Long | False | | Id | | | Description | |Id | 2.x | TransTypeBeanAPS | | | jdbc/mysql | javax.sql.DataSource | Container | | | | | TransactionBean | com.ingotz.entity.TransactionHome | com.ingotz.entity.Transaction | com.ingotz.entity.TransactionLocalHome | com.ingotz.entity.TransactionLocal | com.ingotz.entity.TransactionBean | Container | java.lang.Long | False | id | tr_date | tr_state | tr_summary | tr_non_refundable | id | 2.x | TransactionBeanAPS | | | jdbc/mysql | javax.sql.DataSource | Container | | | | | | | | | Type-Transaction | | TransTypeBeanEnd | One | | TransTypeBean | | | | TransactionBeanEnd | Many | | TransactionBean | | | tr_type | | | | | Then it should work. If not, post your code. Sorry for the mistake. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830066#3830066 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830066 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships and Foreign Keys
Do you change your jbosscmp-jdbc.xml ? The mapping is done in this file. It should be set to Type-Transaction TransTypeBeanEnd TransType tr_type TransactionBeanEnd View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830059#3830059 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830059 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships and Foreign Keys
1) Database auto-increment : You don't experiment this yet because as you says, the TransTypes are predefined (so you do not create records in this table) but the transaction table have the same problem. As I understand, you don't suuceed to create a new transaction record. But if you says that it works anyway for you, it's OK for me. 2) CMR field not CMP : This is correct. You don't have to create the CMP field tr_type. The CMR field is sufficient. Then you can set it in ejbPostCreate passing the TransType class. In addition, in your case, naming both the CMP and the CMR can occurs in a conflict for the getters and the setters. 3) If you experiment a "cannot insert null value" or "explict value" for the primary key creating your Transation record, remember that database auto-incrementted keys are handling through unknown-pk, without declaring teh CMP field for the primary key id. Pascal View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830043#3830043 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830043 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships and Foreign Keys
I changed the code to have a setTransType() which takes the TransType class as a parameter, and I changed the CMR field to be TransType, I now get this error javax.ejb.CreateException: Could not create entity:java.sql.SQLException: Column not found message from server: "Unknown column 'TransType' in 'field list'" Could not create entity:java.sql.SQLException: Column not found message from server: "Unknown column 'TransType' in 'field list'" Could not create entity:java.sql.SQLException: Column not found message from server: "Unknown column 'TransType' in 'field list'" How do you get the fields linking properly? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830042#3830042 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830042 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships and Foreign Keys
The Database is being created with AutoIncrement, but The issue we have is not exactly that, the fields id are auto_increment but we are not going to be creating records using the relationship (in this case) with the related field having to create an autoincrement, We have several Predefined TransTypes, that each transaction can refer to one of them. We would do a find to get the transtype and pass it into the transaction create function - So you are saying that we pass the Class in anyway but the setTr_type function that we use is in the postcreate not the ejbcreate function for it to process the class correctly. and please enlighten me - the cmr field is the field in the table that is the FK, and that field doesn't have to be declared as a CMP field either as it is processed in the postcreate The errors we have been having are varied from Cant find tr_type to cant have 2 primary keys - We tried the using the unknown pk for the autoincrement at first but somehow we have it working correctly here anyway but we need to enforce the field tr_type as a bigint not a blob as we need to just store the reference - If we are doing that will it work automatically or not - are there any easy to understand tutorials that cover the system we are using? Mike. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830015#3830015 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830015 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Relationships and Foreign Keys
Hi, Can you post the exact error log you have because I don't really understand your problem: 1 : If your tables must have the primary key auto incremented by the database, you must declared an tag for each table 2 : The CMR fields (the foreign key) must be set in ejbPostCreate, not in ejbCreate, and you set the CMR field not the foreign CMP field 3 : JBoss is buggeg with database auto-incremented key. So you must set the CMP field tr_type in ejbCreate with setTr_type(tr_type.getId()), the sets the CMR field tr_type in ejbPostCreate. In your description (ejb-jar and jbosscmp-jdbc), you are not in database auto-incremented configuration. If this is right, you can delete the CMP field tr_type, you don't need it. Just work with the CMR field. Also, in your case, you should experiment problems naming the CMP and CMR field tr_type and Tr_Type because the getters will have the same name getTr_type(); View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830011#3830011 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830011 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user