users@glassfish.java.net

RE: Database view with JPA for jdbc realm

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Tue, 26 May 2009 08:55:53 -0400

Felipe is correct

also add in connection-pool
Glassfish Admin interface Resources Connectors JDBC Connector Pool add connector-pool1

--use asadmin to create a new security map
If the security map is not present, a new security-map is created.
create-connector-security-map command will map the caller identity of the application (principal
or user group) to a suitable EIS principal in container-managed transaction-based
scenarios.
One or more named security maps may be associated with a connector
connection pool which you have already created thru GF admin interface
The connector security map configuration supports the use
of the wild card asterisk (*) to indicate all users or all user groups.
example
asadmin> create-connector-security-map --user admin
--passwordfile pwd_file.txt --poolname connector-pool1 --principals principal1, principal2 --mappedusername backend-username securityMap1
Command create-connector-security-map executed successfullyhttp://docs.sun.com/app/docs/doc/819-3662/create-connector-security-map-1?a=view

Saludos Cordiales
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Tue, 26 May 2009 09:17:44 +0200
> From: fgaucho_at_gmail.com
> To: users_at_glassfish.dev.java.net
> Subject: Re: Database view with JPA for jdbc realm
>
> AFAIK, unfortunately you need to run the script before to deploy the
> application... :(
>
>
>
> On Tue, May 26, 2009 at 9:11 AM, <glassfish_at_javadesktop.org> wrote:
> > Hi,
> >
> > I have an application that uses form based security. The realm used is JDBC Realm. I have the entities User and Group for the JDBC realm. All database tables for the application are created when I deploy the application. For User and Group entities the tables users, groups and user_group is created. user_group is just a relation table to avoid redundancy by putting the username in the groups table.
> >
> > However, glassfish jdbc realm implementation requires username to be in the same table as the group name. To solve this it is usually suggested to use a database view, that selects usernames from users table and group names from groups table.
> >
> > But how can i get the container to create a database view, as it creates all the tables from the enteties? I tried the following:
> >
> > In a constructor of a servlet that is loaded at startup, I tried to call an injected (with @EJB) EJB. The EJB has access to an entity manager and executes an SQL create view statement. But, the problem is that in the servlet constructor the EJB instance is still null. I can call the EJB from the doGet method, and it works, but I would like the view to be created at deploy time automatically.
> >
> > My application is packaged in an EAR with one web module and two ejb modules.
> >
> > BR,
> > Mattias
> > [Message sent by forum member 'nightzero' (nightzero)]
> >
> > http://forums.java.net/jive/thread.jspa?messageID=347626
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> >
> >
>
>
>
> --
>
> Please help to test this application:
> http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>

_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage1_052009