[jboss-user] [EJB 3.0] - Re: hibernate and inheritance

2007-12-04 Thread p.chevillon
I found a possible explanation to this problem. It seem's the discriminant 
is'n't used when requesting by a one-to-many in an subclass. So a way to make 
hibernate consider the hierarchy is to force control on the Discriminator 
column. 

With annotations, @Where should be used.
@Where(clause=POI_TYPE='B')
and
@Where(clause=POI_TYPE='C')

But in my example, I really don't understand where I have to place this 
clauses. Any help ?

Thanks

Paulin

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4110262#4110262

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4110262
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: hibernate and inheritance

2007-12-03 Thread p.chevillon
My DB is PostgreSQL. Any Idea ?



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4109738#4109738

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4109738
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - hibernate and inheritance

2007-11-30 Thread p.chevillon
Hello,

I've a problem with requests on sublasses of a class tree (Entity beans). I got 
a org.hibernate.WrongClassException when trying to access data with a oneToMany 
relation.

My architecture is:

A  B  C


  | @Entity
  | @Table(name = A)
  | @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  | @DiscriminatorColumn(name = DTYPE, discriminatorType = 
DiscriminatorType.STRING)
  | @DiscriminatorValue(A_TYPE)
  | public class A implements java.io.Serializable {
  | 
  | private Long id;
  | ...
  | }
  | 
  | @Entity
  | @DiscriminatorValue(B_TYPE)
  | public class B extends A {
  | 
  | // Associations
  | private CollectionObj objSet = new ArrayListObj();
  | 
  | @OneToMany(mappedBy = A)
  | public CollectionReview getObjSet() {
  | return objSet;
  | }
  | 
  | public void setObjSet(CollectionObj objSet) {
  | this.objSet = objSet;
  | }
  | }
  | 
  | @Entity
  | @DiscriminatorValue(C_TYPE)
  | public class C extends B {
  |...
  | }
  | 
  | 

And Obj is defined like:


  | @Entity
  | @Table(name = OBJ)
  | public class Obj {
  | private B value;
  | 
  | @ManyToOne
  | @JoinColumn(name=A_ID)
  | public AppPOI getValue() {
  | return value;
  | }
  | 
  | public void setValue(B value) {
  | this.value = value;
  | }
  | 
  | }
  | 

When I create a new Obj and associate it to a B Entity it works. (correctly 
added to the DB, good ID pointing from OBJ to a A like entry)

Now when I try to access using this request:
SELECT obj FROM Obj obj WHERE obj.value.id=44549450

It gives me that error message:

  | org.hibernate.WrongClassException: Object with id: 44549450 was not of the 
specified subclass: C (Discriminator: B_TYPE)
  | 

I'm using using jboss 4.0.5 with seam and hibernate updated to version 3.2.5ga

Thanks for your help, I couldn't find an answer to my problem with the search 
function of this forum, I've passed so many times reading it at this point...

Paulin



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4109352#4109352

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4109352
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Double authentication in different parts of a site

2007-09-17 Thread p.chevillon
Hello,

I have a other problem with my authentication. My  idea was to extend 
RuleBasedIdentity  and so create ECIdentity  class.

Here is my program:


component.xml
security:identity 
  | class=ecidentity
  | authenticate-method=#{authenticator.authenticate}
  | security-rules=#{securityRules}/
  | 

ECIdentity.java
@Name(ecidentity)
  | @Scope(SESSION)
  | @Intercept(InterceptionType.AFTER_RESTORE_VIEW)
  | @Startup
  | public class ECIdentity extends RuleBasedIdentity {
  | 
  | String role = null;
  | 
  | 
  | public String login() {
  | 
  | 
  | System.err.println(First login);
  | 
  | return super.login();
  | 
  | }
  | }   
  | 

Authenticator.java
@Name(authenticator)
  | public class Authenticator {
  | @Logger Log log;
  | 
  | @In(value=ecidentity) ECIdentity ecIdentity;
  | 
  | @In EntityManager entityManager;
  | 
  | @In(#{messages['ErrorOnLogin']}) private String LoginError;
  | 
  | public boolean authenticate() {
  | 
  | System.err.println(First authenticate);
  | System.err.println(Username = 
+ECIdentity.instance().getUsername());
  | 
  | try {
  | String hashedPassword = Util.createPasswordHash(MD5, 
Util.BASE64_ENCODING, null, null,ECIdentity.instance().getPassword());
  | 
  | Mb member = (Mb) entityManager.createQuery(
  | from Mb where login = :username and passwd = 
:password)
  | .setParameter(username, 
ECIdentity.instance().getUsername())
  | .setParameter(password, hashedPassword)
  | .getSingleResult();
  | 
  | return true;
  | }
  | catch (NoResultException ex) {
  | FacesMessages.instance().add(LoginError);
  | return false;
  | }
  | }
  | }
  | 

And when I submit  (the action performed is #{ecidentity.login}  ), I get the 
following error message in the console:



15:46:53,967 ERROR [STDERR] First login
  | 15:46:54,386 ERROR [STDERR] First authenticate
  | 15:46:54,387 ERROR [STDERR] Username = null
  | 15:46:54,411 ERROR [SeamLoginModule] Error invoking login method
  | javax.faces.el.EvaluationException: Exception while invoking expression 
#{authenticator.authenticate}
  | at 
org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
  | at 
org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
  | at 
org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
  | at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:148)
  | at 
org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:104)
  | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 
  | 
  | ...
  | ...
  | 
  | Caused by: java.lang.NullPointerException
  | at org.jboss.security.Util.createPasswordHash(Util.java:407)
  | at org.jboss.security.Util.createPasswordHash(Util.java:378)
  | at 
com.easycity.ejb.Authenticator.authenticate(Authenticator.java:35)
  | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 
  | 
  | 
  | 
  | 


I have no idea why my ECIdentity object isn't reacheable.

Thanks for your help.

Best regards
PC

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4085063#4085063

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4085063
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Double authentication in different parts of a site

2007-09-17 Thread p.chevillon
Something to add:

When the seam login page is loading, the term print on screen

16:25:30,082 INFO  [ServletCacheAdministrator] Created new instance of 
ServletCacheAdministrator
  | 16:25:30,083 INFO  [ServletCacheAdministrator] Created new 
application-scoped cache at key: __oscache_cache
  | 16:25:30,372 INFO  [Lifecycle] starting up: org.jboss.seam.security.identity
  | 16:25:32,059 INFO  [Lifecycle] starting up: ecidentity
  | 

Is that normal to load twice identity  ecidentity for my use ?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4085079#4085079

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4085079
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Double authentication in different parts of a site

2007-09-14 Thread p.chevillon
Hello,

I ask for your help on an authentication procedure with seam.

Users are in different tables (User and ExtraUser), I want make the difference 
beetween those two kind of users. So the login page have to be separated etc.

My problem is the Identity component configured in component.xml. It refers to 
only 1 method and I would like to use separated Identity based components 
depending on the part of the application used (eg. User or ExtraUser login -and 
then- home page).

Is that possible ? If yes please you tell me, I absolutely found nothing like 
that in the forum archives...

Best regards

PC

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4084355#4084355

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4084355
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Double authentication in different parts of a site

2007-09-14 Thread p.chevillon
Thanks Samuel

I try that right now !

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4084485#4084485

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4084485
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user