[EJB 3.0] - JoinColumns with AnnotationException
by penguine
in my entity I have the following annotation. I have generated the entities with DALI_0.5:
---------------BEGIN----------------------
@Entity
public class Stoerung implements Serializable {
@EmbeddedId
private Stoerung.PK pk;
...
private Aggregat nameaggregat;
@ManyToOne
@JoinColumns({
@JoinColumn(name="NAMEANLAGENTEIL", referencedColumnName="NAMEANLAGENTEIL"),
@JoinColumn(name="NAMEAGGREGAT", referencedColumnName="NAMEAGGREGAT")
})
private Anlagenteil anlagenteil;
.
.
.
.
----------------ENDE-------------------
the entity with the FK is the following:
------------ BEGIN------------------------
@Entity
public class Anlagenteil implements Serializable {
@EmbeddedId
private Anlagenteil.PK pk;
@ManyToOne
@JoinColumn(name="NAMEAGGREGAT")
private Aggregat nameaggregat;
@OneToMany(mappedBy="anlagenteil")
private Set stoerungCollection;
private static final long serialVersionUID = 1L;
public Anlagenteil() {
super();
}
public Anlagenteil.PK getPk() {
return this.pk;
}
public void setPk(Anlagenteil.PK pk) {
this.pk = pk;
}
public Aggregat getNameaggregat() {
return this.nameaggregat;
}
public void setNameaggregat(Aggregat nameaggregat) {
this.nameaggregat = nameaggregat;
}
public Set getStoerungCollection() {
return this.stoerungCollection;
}
public void setStoerungCollection(Set stoerungCollection) {
this.stoerungCollection = stoerungCollection;
..
..
..
-------------ENDE----------------
and the exception is:
---------BEGIN---------------
2007-08-07 16:13:24,000 DEBUG [org.hibernate.cfg.annotations.CollectionBinder] Collection role: com.mycompany.entity.Stoerungsgrund.stoerungCollection
2007-08-07 16:13:24,000 DEBUG [org.hibernate.cfg.annotations.PropertyBinder] Building property stoerungCollection
2007-08-07 16:13:24,000 DEBUG [org.hibernate.cfg.AnnotationConfiguration] processing manytoone fk mappings
2007-08-07 16:13:24,000 DEBUG [org.jboss.ejb3.ServiceDelegateWrapper] Starting failed persistence.units:jar=EnityTest.jar,unitName=Stoerzeit
org.hibernate.AnnotationException: referencedColumnNames(NAMEANLAGENTEIL, NAMEAGGREGAT) of com.mycompany.entity.Stoerung.anlagenteil referencing com.mycompany.entity.Anlagenteil not mapped to a single property
at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:165)
at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:63)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:428)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:286)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:407)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
.
.
.
.
--------------ENDE---------------------
has someone an idea?
Thanx for help
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071644#4071644
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071644
18Â years, 8Â months
[JBoss Portal] - Re: Cannot retrieve user: Unable to locate current JTA trans
by kpalania
Sohil,
The reason I need to use my own security realm is because this realm is shared by more than one application and JBoss Portal is just one of the applications deployed in JBoss that uses this shared realm.
The way I've implemented this -
* There is a shared security realm (and possibly, more than 1 at some point) used by multiple applications.
* I also have a use case for bypassing security (trusted application scenario, etc.), so I can't rely on container managed security and j_security_check as it would ALWAYS challenge the user and I don't want that in certain cases.
* So, I moved to using my own Servlet and have that do something like this:
UsernamePasswordHandler handler = new UsernamePasswordHandler(username,
| password);
| LoginContext context = new LoginContext("SecurityRealmName", handler);
| context.login();
* This works for my application but it doesn't for JBoss Portal though the authentication succeeds.
* Enabling trace logging, I can tell that the principals are not being set and hence, the JBoss Portal authorization fails.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071642#4071642
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071642
18Â years, 8Â months