[Persistence, JBoss/CMP, Hibernate, Database] - Advanced problems with Jboss and Hibernate !
by DivxYoda
Hi every body,
Look at these classes examples to see my problems with hibernate on jboss (for a mySql database) and understand what i want to do :
@Entity
@Table(name=Mother)
@Inheritance(strategy = InheritanceType.JOINED)
public class Mother implements Serializable{
@Id
private String mother_id;
public Mother(){}
//... getters/setters generated for all fields members
}
Note : The Mother table has a single primary key : its id
@Embeddable
public Class DaughterKey implements Serializable{
private String mother_Id;
private String daughter_id;
public DaughterKey(){}
//getters/setters generated for the both fields
// the methods : toString(),hasCode(),equals() are overrided
}
Note : the DaughterKey is a class that specifies (according to my understandings) a composite primary key class when mappings happen !
@Entity
@Table(name = "Daughter")
@IdClass(DaughterKey.class)
@PrimaryKeyJoinColumn(name = "Mother_id")
public class Daughter extends Mother{
@Id
private String daughter_id;
public Daughter(){ super();}
//.. getter/setter for all fields
}
Note: the Daughter table has a composite key (mother_Id+daughter_id).
So,the idea is that eventhough a Daughter Class extends a Mother Class, the Daughter must have 2 fields-members as PrimaryKey in the Database (the mother_id and its own daughter_id) : a composite key.
After compiling and creating a JAR file, I try to deploy the JAR-file and i have a such exception :
java.lang.reflect.InvocationTargetException
//.... at ....
caused by
org.hibernate.AnnotationException : Unable to define/override @Id(s) on a subclass : Daughter.
Thanks a lot if someOne can help me, I know that it's because my conception is not correct but I can't get any better ided.
PS : Ask your questions, if you don't understand my idea !
Best regards, Divx.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984923#3984923
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984923
19Â years, 7Â months
[EJB 3.0] - Advaned problems with Jboss and Hibernate !
by DivxYoda
Hi every body,
Look at these classes examples to see my problems with hibernate on jboss (for a mySql database) and understand what i want to do :
@Entity
@Table(name=Mother)
@Inheritance(strategy = InheritanceType.JOINED)
public class Mother implements Serializable{
@Id
private String mother_id;
public Mother(){}
//... getters/setters generated for all fields members
}
Note : The Mother table has a single primary key : its id
@Embeddable
public Class DaughterKey implements Serializable{
private String mother_Id;
private String daughter_id;
public DaughterKey(){}
//getters/setters generated for the both fields
// the methods : toString(),hasCode(),equals() are overrided
}
Note : the DaughterKey is a class that specifies (according to my understandings) a composite primary key class when mappings happen !
@Entity
@Table(name = "Daughter")
@IdClass(DaughterKey.class)
@PrimaryKeyJoinColumn(name = "Mother_id")
public class Daughter extends Mother{
@Id
private String daughter_id;
public Daughter(){ super();}
//.. getter/setter for all fields
}
Note: the Daughter table has a composite key (mother_Id+daughter_id).
So,the idea is that eventhough a Daughter Class extends a Mother Class, the Daughter must have 2 fields-members as PrimaryKey in the Database (the mother_id and its own daughter_id) : a composite key.
After compiling and creating a JAR file, I try to deploy the JAR-file and i have a such exception :
java.lang.reflect.InvocationTargetException
//.... at ....
caused by
org.hibernate.AnnotationException : Unable to define/override @Id(s) on a subclass : Daughter.
Thanks a lot if someOne can help me, I know that it's because my conception is not correct but I can't get any better ided.
PS : Ask your questions, if you don't understand my idea !
Best regards, Divx.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984921#3984921
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984921
19Â years, 7Â months
[JBossCache] - JBossCache vs JMS vs JGroups
by bob_ninja
I am not sure which to use and what the distinction is. I understand that JGroups sits below the 2, and is a lower level API. Fine. But how do you decide between a caching API (JBossCache) and a JMS API (JBoss MQ)?
My app consist of several modules (web app in a J2EE server plus several other specialized servers) that are clustered. It has certain transient state that may change at medium to high frequency, so database is not a good place for it. This state needs to be shared/accessed between modules as well as different machines in a cluster.
Now there are a lot of choices:
1) Java Space API
2) Java Caching API (JBossCache)
3) JMS API (JBoss MQ)
4) lower level JGroups API
The "safe" choice would be (3) messaging. However, JBossCache is specifically designed for sharing of beans between multiple VMs, so seems like a better choice.
I guess my problem is that cacheing and messaging APIs are so close/similar that I am having a hard time choosing between them. Help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984920#3984920
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984920
19Â years, 7Â months
[JBoss Seam] - Invalid invocation of local interface - seam registration ex
by maek1975
Hi
I'm getting an exception when trying to access a jsp-page (test.seam), its the code from the seam message example.
The exception is:
javax.faces.el.EvaluationException: Cannot get value for expression '#{messageList.rowCount==0}'
Caused by: javax.naming.NamingException: Could not dereference object : Invalid invocation of local interface]
..
Caused by: java.lang.ClassCastException: org.jboss.ejb3.stateful.StatefulLocalProxyFactory
I have followed the seam registration/message example in order to configure my enviroment.
I have a MyEarApp.ear, a busniess.jar and a web-war.war.
My component gets registred:
Component: messageManager, scope: SESSION, type: STATEFUL_SESSION_BEAN, class: se.smhi.voyage.ejb.MessageManagerBean, JNDI: RattenApp/MessageManagerBean/local
My component is slightly different from the seam example:
MyEarApp/#{ejbName}/local
My JBoss installation should contain EJB3 (4.0.5 GA)
How do I configure the jboss-app.xml that resides in myEarApp/meta-inf?
If I put in something like: seam.jboss.org:loader=MyEarApp , I would receieve an error upon JBOSS startupp...
Whats might be missing?
Thanks in advance!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984917#3984917
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984917
19Â years, 7Â months