JPA (Eclispelink/toplink) and VPD

I have so far stumbled only on this link for implementing VPD in JPA :http://wiki.eclipse.org/EclipseLink/Examples/JPA/Auditing
Is there any other link which explains how to achieve row level security(VPD) using JPA?

user8093550 wrote:
We are injecting this(EM) into our session bean, so, i guess we are not essentially using EntityManagerFactory - how can we achieve this without an EMF? Is it possible?
If you are using JPA 2.0 you can inject the EM and set the properties using em.setProperty.
If you are using EE5 you'd need to use EclipseLink specific APIs ((org.eclipse.persistence.internal.jpa.EntityManagerImpl)em.getDelegate()).setProperties( ....You'll need to test this out though because you may need to call em.clear to force a new EntityManager to be created if your setProperties was executed when the EM had already been created.
Also, how does this work, i mean, if i set VPD once during user login, and then does the entitymanager keep this sanctity all throughout the user's session?Since the settings are tied to an EntityManager I would think that they are applied for all operations through an EntityManager.
Be sure to read this carefully before you start though: http://wiki.eclipse.org/Introduction_to_EclipseLink_Sessions_%28ELUG%29#Isolated_Client_Sessions_and_Oracle_Virtual_Private_Database_.28VPD.29

Similar Messages

  • Toplink and VPD

    Hi,
    In a three-tier architecture, has anyone successfully implemented VPD in combination with Toplink and a ConnectionPool?
    When all my web-users are connecting to the database with the same (connection pool) credentials, how, when and where do I tell my database who is really logged in (web-user) and thus how to set the specific VPD for that web-user?
    Thanks. I already read another post on this forum mentioning that VPD support would be included in an upcoming release of TopLink.
    Re: toplink and Oracle VPD
    I also heard of a patch to download. Can anyone verify this?

    Just to add an extra question: Is it true that when one is using chained Toplink actions in a request-response cycle that each action will fetch its own connection from the pool and thus for each time a connection is fetched the VPD needs to be set again?
    This in contrast with BC4J, where all actions in a request-response cycle will share the same application module and thus the same connection.
    Bottom line: how to configure Toplink so that for each fetched connection it tells the database: "Hey, its me again, please set the application context (VPD) to my own personal values, so I will only see my own records"?
    . And to clean it up nicely: just before the connection is released to the pool: "Ok, I'm done, please reset the application context, so other users will not be bothered by my context".
    Hard to believe nobody has tried this before.

  • Useing toplink jpa in jdev11 and mysql4,but meet the DatabaseException

    Hello everyone,I'm useing toplink jpa in jdev11 and mysql4.I create a class from database success.Then I use "Java Service Facade" to create a class called JavaServiceFacade sucess.Then I add some code:
    System.out.println(javaServiceFacade.queryCnationalityFindAll().size())
    in main
    then I run the program,but I got this error:
    xception in thread "main" Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
    Error Code: 0
         at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:290)
         at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:87)
         at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:170)
         at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:218)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.connect(DatabaseAccessor.java:227)
         at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:294)
         at oracle.toplink.essentials.threetier.ConnectionPool.buildConnection(ConnectionPool.java:102)
         at oracle.toplink.essentials.threetier.ConnectionPool.startUp(ConnectionPool.java:324)
         at oracle.toplink.essentials.threetier.ServerSession.connect(ServerSession.java:443)
         at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:571)
         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:208)
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:212)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:111)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:105)
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76)
         at project6.JavaServiceFacade.getEntityManager(JavaServiceFacade.java:23)
         at project6.JavaServiceFacade.queryCnationalityFindAll(JavaServiceFacade.java:72)
         at project6.JavaServiceFacade.main(JavaServiceFacade.java:18)
    Caused by: java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
         at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
         at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:140)
         at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:85)
         ... 17 more
    there's some chinese you may not know,that means there's something wrong with
    Microsoft odbc.I'm puzzle of that:I'm useing java+mysql,why there's wrong with odbc???
    thank you very much
    (maybe it's jdev11 technical preview edition so it can't work?)

    HI
    can you reply the feedback of metalink? because I'm having similar problem.
    I debug in junit and embebbed at the jdev and it works well, but when I deploy in a standalone oc4j it gives me the same error of Excepção de E/S: The Network Adapter could not establish the connection
    And I'm not using 11g, I'm still in 10g but the problem might be the same.
    cumps
    DnlCY
    null

  • What are the difference between TopLink and TopLink Essentials...?

    What are the difference between TopLink, TopLink Essentials, EclipseLink and TopLink Essentials-GlassFish?
    What is the difference of their functions?
    Edited by: qkc on Nov 21, 2009 10:52 AM

    Difference between TopLink and ToPLink Essentials:
    TopLink Essentials are the reference implementation (RI) of JPA, is an open source effort that is licensed under the Common Development and Distribution License (CDDL) v1.0. It can be freely downloaded and used under the terms of this license agreement. This means, you can only use it for the management of persistence and orm with Java EE and Java SE. The binary distribution of TopLink consist of 2 jars:
    * toplink-essentials-agent.jar: contains Java Persistence API; XML Schemas and TopLink essentials implementation
    * toplink-essentials.jar: contains java agent class requires in a standolane Java SE application
    In addition to TopLink Essentials that makes the JPA implementation alive, Oracle offers its Oracle TopLink product (10.1.3) that contains an earlier preview binary of JPA and also offers developers additional object-relational capabilities, object-XML mapping (JAXB), non-relational mapping using Java 2.0 Connector Architecture (JCA).
    Let's wait other person to answer these questions.

  • Behaviour of updateObject and writeObject in toplink and eclipse link

    Hi all ,
    Please let us know if there is any difference between updateobject and writeobject being used in toplink and eclipselink.jar ?
    It would be greatly helpful if someone can say the scenarios to use both the objects in eclipselink.jar .
    Thanks in advance.
    Regards
    Mythili

    In general you should not use either of these, but either use JPA, or use the UnitOfWork.
    updateObject and writeObject are only defined in a single user DatabaseSession.
    updateObject will just update the object, it assumes the object exists
    writeObject can either insert or update an object, it first performs a doesExist check to see if an insert or an update should be done.
    James : http://www.eclipselink.org

  • JDeveloper, Toplink, and ADF advice.

    We have application that was completely developed JDeveloper 10.1.3/4 with Toplink, JSF, ADF, and Session Facade; extremely similar to the SRDemo.
    I am want to upgrade to JDeveloper 11g; however, the ADF Faces JSF will be migrated to Apache MyFaces Trinidad.
    1. Why would this be better than migrating to ADF Faces 11g? Pros and cons?
    2. Is Apache MyFaces Trinidad the future of Oracle's ADF?
    3. What would be the best approach for upgrade to Toplink and ADF 11g?
    Thank you.

    1. Why would this be better than migrating to ADF Faces 11g? Pros and cons?It won't be better than using ADF Faces 11g - it is just more feasible for automatic conversion - we can't do automatic conversion from ADF FAces 10.1.3 to ADF Faces 11g since the UI capabilities are so drastically different. We migrate to Trinidad to allow you to combine Trinidad and ADF Faces 11g in the same application. (You can't use ADF Faces 10.1.3 and 11g in the same application).
    2. Is Apache MyFaces Trinidad the future of Oracle's ADF?No. ADF Faces Rich Client is the present and future. Those are based on Trinidad.
    3. What would be the best approach for upgrade to Toplink and ADF 11g?The basic thing to do is open the application in JDeveloper 11g - things should work after the migration.
    Then you can start leveraging new capabilities such as the new ADF Faces 11g UI in new parts of the application.
    You might want to ask on the TopLink forum if they have any specific migration tips.

  • BUG!?! Toplink and XE in Jdev 10g Rel 3 SU4

    Good ... evening/morning ... everyone! :-)
    Trying to follow (teach using) the tutorial on creating an Web App using Toplink
    and ADF Faces. After creating the Map I am getting problems on the Java object
    generation. I get the exception:
    java.lang.NullPointerException
    at oracle.ideimpl.log.TabbedLogManager.getMsgPag (TabbedLogManager.java:101)
    at oracle.toplink.addin.log.POJOGenerationLoggingAdapter.updateTask(POJOGenerationLoggingAdapter.java:42)
    at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.fireTaskUpdated(MappingCreatorImpl.java:1049)
    at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:231)
    at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:201)
    at oracle.toplink.addin.wizard.jobgeneration.JobWizard$1.construct(JobWizard.java:401)
    at oracle.ide.util.SwingWorker$1.run(SwingWorker.java:119)
    at java.lang.Thread.run(Thread.java:595)
    and JDev get in a endless loop in the generation progress dialog. The only
    difference from the tutorial setting is XE instead of a full server!
    Hope someone have some hints; just let me know if further details of the setting
    is needed!
    Dan.

    Good ... evening/morning ... everyone! :-)
    Trying to follow (teach using) the tutorial on creating an Web App using Toplink
    and ADF Faces. After creating the Map I am getting problems on the Java object
    generation. I get the exception:
    java.lang.NullPointerException
    at oracle.ideimpl.log.TabbedLogManager.getMsgPag (TabbedLogManager.java:101)
    at oracle.toplink.addin.log.POJOGenerationLoggingAdapter.updateTask(POJOGenerationLoggingAdapter.java:42)
    at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.fireTaskUpdated(MappingCreatorImpl.java:1049)
    at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:231)
    at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:201)
    at oracle.toplink.addin.wizard.jobgeneration.JobWizard$1.construct(JobWizard.java:401)
    at oracle.ide.util.SwingWorker$1.run(SwingWorker.java:119)
    at java.lang.Thread.run(Thread.java:595)
    and JDev get in a endless loop in the generation progress dialog. The only
    difference from the tutorial setting is XE instead of a full server!
    Hope someone have some hints; just let me know if further details of the setting
    is needed!
    Dan.

  • Portal 902 and VPD

    Hi,
    Portal 902 is supposed to be integrated with VPD. Is there any documentation on this integration? I have looked all over Technet and also the Portal online documentation, and cannot find anything, except for some stuff in Metalink on VPD in 309. Any clues anyone?
    Regards,
    Steve West

    The integration refers to the ability to DB users to Portal users. See the following note for implementation details for Portal and VPD. R2 should be no different.
    Note:177471.1

  • OLS    AND    VPD Column Masking.

    I have gone over a couple of sources on OLS and VPD.
    BTW I am working with Oracle 11g R1.
    What I am trying to accomplish is cell level protection. Where cell is defined as the intersection between a row and a column.
    OLS will get me the proper row restrictions.
    VPD has the ability to do Column Masking.
    Has anyone mix the two to accomplish cell level protection?
    Basic examples would be GREATLY appreciated.

    Hi again. Thank you for your reply, but I wanted to achieve cell-level security as I'm trying to create conception of fine-grained processing data with different levels of confidentiality. Here is what I have:
    - I created 3 levels of confidentiality: J < P < T (Unclassified < Confidential < Secret)
    - I created a table and here is how it looks for different users:
    User with T-level authorization:
    !http://img709.imageshack.us/img709/1847/screentj.png!
    User with P-level authorization (can't see T-level data):
    !http://img704.imageshack.us/img704/4002/screenp.png!
    I did that by creating two policies on two columns with data:
    CREATE OR REPLACE FUNCTION f_data01 (schema in varchar2, tab in varchar2) -- or "CREATE OR REPLACE FUNCTION f_data02" for second column
      RETURN varchar2 AS
        predicate         varchar2(2000);        -- the VPD 'where' clause
        session_lab        varchar2(4000);        -- the current user's session label
        session_tag        number;            -- numerical expression of session label
        t_sa_user_name    varchar2(2000);        -- only users with Labels are examined, others don't get access.
    BEGIN
      session_lab := sa_session.label('cells');        -- the current user's session label for that policy
      session_tag := char_to_label('cells',session_lab);    -- numerical expression of session label
      predicate := 'dominates(' || session_tag || ',CDATA01)=1'; -- or "predicate := 'dominates(' || session_tag || ',CDATA02)=1';" for second column
      return predicate;
    END;I asked if it is possible to create one policy with variable instead of column name (ex. CDATA01) or if there is another way to get that effect.
    And is it good practice to put column with labels in one table with data?
    Thank you in advance.
    Edited by: arc.undcvr on 2010-01-23 22:50

  • Can I implement the ORM task without TopLink and Hibernate?

    Can I implement the ORM (Objest/Relational Mapping) task without TopLink and Hibernate tools?

    Any opinions are welcome.

  • Desktop Conference 2005 includes Java, TopLink and more

    Checkout Desktop Conference 2005 (www.desktopconference2005.org or www.odtug.com) for information on Desktop Conference 2005, the virtual conference webcast sponsored by Oracle, ODTUG, and BIDW SIG of OAUG. It's powered by Oracle's Collaboration Suite Web Conferencing and features all-star presenters and exceptional technical content February 15-17. Since it's virtual, there's no need to travel. All you need is a PC and internet connection.
    Java/J2EE topics include J2EE, Web Services, JSF, Struts, ADF, BPEL, Frameworks, TopLink and more. Java/J2EE experts include Rod Johnson, Bruce Tate, Richard Monson-Haefel, Paul Dorsey, Toon Koppelaars, and Sri Rajan.
    Oracle Java/J2EE experts include Dai Clegg, Duncan Mills, Avrom Faderman, Steven Davelaar, Frank Nimphius, Tugdual Grall, Sue Harper, Jonas Jacobi, Anuj Jain, Stacen Anderson, Katarina Obradovic-Sarkic, and David Shaffer.
    Great keynotes addresses include Oracle's Thomas Kurian, Senior VP, Development OAS. The conference has a lot to offer so I hope you can check it out. Thanks. Maggie Tompkins

    There are several sessions done by the JDeveloper Product Management as well as several sessions done by othre users of JDeveloper. Check out both the Java track and the Oracle track.
    See the detailed agenda here:
    http://www.desktopconference2005.org/03-agenda/index.html
    Can be a nice opportunity to "go" to a conference if your company is on a tight travel budget.

  • TopLink and Stored Procedures

    Hi all
    We are migrating an application made with MS ASP's to a full blown J2EE application using ADF, JSF and toplink, atm we've used the mapping abilities from toplink and have saved lots of work, however i'd like to know if there's aw ay to map the Stored procedures the same way you map the tables. This would be a great time saving routine, if not available we might have to write it but I thought we would ask here first. Any pointers?
    greetings!

    TopLink does fully support invoking stored procedures for any query. It is not available in the graphical mapping editors but is available through the API. Look in the documentation for StoredProcedureCall.
    Doug

  • EJB3 and/or Toplink and setting context for VPD

    We are looking at moving to the latest version of jdeveloper and taking advantage of the ejb3 and/or toplink features for the model part of applications. I have a question on how to set the vpd context using this new model. Currently we use:
    Jdeveloper 10.1.2.1
    Oracle application server 10g R2 Enterprise Edition ver 10.1.2.0.2
    OracleOCI driver
    Oracle 9i database
    Our database access is in regular java beans where we get a connection from the pool , set the context for the current user (by running a stored procedure on the connection) perform the required data access and then release the connection. It looks like when you use Toplink or EJBs with CMP the database access is out of the developer's control. How will I be able to set the context for each connection ( it's different for each user) once I move to the new model?

    Thank you. That looks like exactly what I need, at least for toplink. I have been told though, that since we are deploying to the OC4J container and it will manage persistence and since EJB 3 simplifies the creation of entity beans that we should use EJB 3 entity beans and a session facade for the model and not add toplink as it would be an extra layer we don't really need , would you agree?

  • Toplink and Oracle VPD

    Our dba's have VPD set up which limits data depending on who is logged in. Can this be supported with Toplink in 'Server' mode, using Session beans with POJO's?
    thanks,
    craig
    ps. if this is not supported, any suggestions?

    Craig,
    This is not currently an out of the box capability, but through TopLink's public API it has been successfully implemented at a couple of customer sites. These extensions to the TopLink persistence architecture have been done through our technical services team. Drop me an e-mail ([email protected]) and I'll connect you with the team to discuss your specific requirements and solution options.
    There are a number of ways Label Security (VPD) can be used from Java with TopLink. The solution used so far involves a custom OCI connection pool that TopLink can switch the user at runtime on. Then depending on the granularity of your user security requirements the TopLink sessions (shared or isolated) can be overlaid using these shared connections. Your application will need to provide user credentials to TopLink so the connection can be properly switched and TopLink's session cache will need to ensure the trusted application only sees cached objects valid for the provided user.
    We are working on adding this support more seamlessly for an upcoming release.
    Doug

  • JPA Project, TopLink Server session and ClassLoader issue

    hi,
    I'm working on the project where JPA annotations are used to describe the mapping between POJOs and the database tables. JpaHelper class is used to bridge the gap between toplink-essentials and toplink. The EntityManagerFactory and the oracle.toplink.threetier.Server are obtained as following:
    emf = JpaHelper.getEntityManagerFactory(Persistence.createEntityManagerFactory("myUnit"));
    server = JpaHelper.getServerSession(emf);
    Due to different functional and architectural constraints the same Server session has to be shared across different web applications. Thus the EntityManagerFactory has been bound to Weblogic JNDI tree and used by web applications to obtain Server session. It works very well for the very first client that is trying to query the data, but due to the fact that in the web container different web applications are using different ClassLoaders the QueryException “Missing descriptor for [class ...]” is being thrown for all consecutive call from other web applications. The same behaviour is observer after re-deploying the “first” application.
    Going throughout different threads in the forum I learned that it could be solved for the "pure TopLink" projects where “sessions.xml” is used as following:
    oracle.toplink.internal.helper.ConversionManager.getDefaultManager().setShouldUseClassLoaderFromCurrentThread(true);
    boolean shouldLoginSession = true;
    boolean shouldRefreshSession = true;
    boolean shouldCheckClassloader = true;
    session = SessionManager.getManager().getSession(new XMLSessionConfigLoader(), "mySession",
    Thread.currentThread().getContextClassLoader(), false, true, true);
    Could you please let me know if there is something similar for JPA projects where “sessions.xml” isn’t used or other options have to be considered?
    regards,

    I am not completely sure I understand what product and version you are using. TopLink Essentials and Oracle TopLink are independent products. They share the same heritage and much of the same functionality but typically you would only use one of them in an application.
    If you have multiple web applications (WAR) that need to share the same JPA persistence unit I would package all of the JPA classes in their own JAR file and co-locate all of these WARs with the persistence JAR in a single EAR file. This should give you the capability to share the classes across the web applications.
    Doug

Maybe you are looking for

  • Macbook Pro 13' early 2011 SCM/battery problem on Mavericks

    After updating to Mac OS X Mavericks I started getting problems with battery/charging of my laptop. Mostly when I touch my laptop after inactivity it just crashes, i see black screen and when I push power button it restarts. What's more, after black

  • How do you shrink a file size?

    I recorded a live set (about 2 hrs worth and 20 songs or so) and the file is 30 gig. I cut out each song, create a new project to work on them separately, but when I save the new file it is still 30 gig. It looks like all the data from the original r

  • OIM Admin Console Browser Compatability

    Can any one tell what are all the browsers and there versions that OIM Compatible with.

  • Got new ipod mini, wont charge! Shows ipod w/sad face

    I just bought a 4GB ipod mini. Whenever I charge it [i use the charger on the "iHome" dock] it first shows the apple logo, then after a few seconds it shows the little ipod with a sad face, and it says "apple.com/support/ipod" then after displaying t

  • Regd. change documents

    Hi, I have to link a business object event to a change document object. I have also to create this change document object. It's a custom object. I have created the change document object and generated the update program. What else do I need to do for