JPA EntityManager shared across OSGi modules

Hi,
I'd like to create an OSGi module which would act as a 'JPA master' making JPA EntityManager available to other OSGi modules. The persistence.xml would be part of this module but it would do nothing more.
I'd like to then access EntityManager from other OSGi bundles, both JARs and WARs (JAR Bundles and WAR Bundles).
I'm running on GlassFish 3.1.2.2 and using EclipseLink as the JPA provider.
Any idea for best practices?
Thank you

Hi, thanks for the link.
It says 'Refer to the examples to see it being used.' without a link so I read the section above that (8. JPA in OSGi Application)
It says about some config entries in GlassFish, I enabled it but still no luck.
Here's my /src/main/resources/META-INF/persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<persistence-unit name="cmsdbconnection">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
     <exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://172.16.145.139:3306/test_db"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="db_user"/>
<property name="javax.persistence.jdbc.password" value="db_user"/>
<property name="eclipselink.ddl-generation.table-creation-suffix" value="engine=InnoDB" />
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.target-server" value="=SunAS9" />
</properties>
</persistence-unit>
</persistence>
Maven pom.xml to generate MANIFEST.MF:
<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                    <extensions>true</extensions>
                    <configuration>
                         <archive>
                              <manifestEntries>
                                   <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                                   <Bundle-SymbolicName>com.ifp.vault.service.persistence</Bundle-SymbolicName>
                                   <Bundle-Version>${project.version}</Bundle-Version>
                                   <Import-Package>org.osgi.framework,org.osgi.util.tracker,javax.persistence;jpa="2.0";version="1.1.0",org.eclipse.persistence.jpa</Import-Package>
                                   <JPA-PersistenceUnits>cmsdbconnection</JPA-PersistenceUnits>
                                   <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
                              </manifestEntries>
                         </archive>
                    </configuration>
               </plugin>
Deploying in GlassFish succeeds, but I cannot obtain the EntityManagerFactory from other OSGi bundles.
Should that be registered as an OSGi service anyway? Because I can't see that when listing all OSGi bundles.

Similar Messages

  • Sharing view objects across application modules

    Our application uses multiple application modules because of the complex functional requirements. We have come across sharing view objects among application modules. I want to understand the best practice, sharing view object instances across application modules. These view objects can be based on Entity Objects also.
    Please let me know if there any suggestions.
    Thanks,
    Satya

    Hi Satya,
    You won't be able to share view objects between application modules, but what you can do is to share the bind variables between application modules, if each of your module contains the 'common' view object.
    A solution for sharing data between application modules is provided on this blog: http://andrejusb.blogspot.co.uk/2012/05/solution-for-sharing-global-user-data.html
    You can use this approach to share bind variables between AM's and re-query the same data.
    Hope this helps,
    Florin Marcus
    www.redsamuraiconsulting.com

  • Folder access across all Modules ?

    Hi,
    Something that irritates me with LR(2,3,4) is that the FOLDER panel is not available across all modules. hence you have to create a collection or preselect your pictures first in Library . Does this bother anyone else ?

    It bothers me, too.
    Why don't you create an idea in the official feature request forum
    http://feedback.photoshop.com/photoshop_family/ideas/recent
    about it and post the link to your creation here?
    It really should not be much of a problem to add the folder panel to the top left side underneath a navigator if available, where anybody would look for it. We are nicely conditioned to this LR user interface principle.
    You will get my vote immediately!
    Cornelia

  • TS2972 I cannot seem to get all of my music shared across the network from my MacBook Pro to my iPad. This was not an issue a few days ago. Can anyone help?

    I cannot seem to get all of my music shared across the network from my MacBook Pro to my iPad. This was not an issue a few days ago. I can see all my songs if sorted that way, but if i sort by artist, only a few of them are present. Can anyone help or have any insight?

    Well I didn't think of it before, but I logged out of my apple ID othe iPad's home sharing. The I logged back in and it worked. It's a little weird, but I will take it. Thanks!

  • Printer sharing across internet sharing

    I hope I don't confuse everyone with this.
    I have three computers—an iMac running Snow Leopard, an iMac running Lion, and a Mini running Leopard. The SL iMac has a printer plugged into it. The other two computers are across the house from it.
    Those two computers are next to each other. The Lion iMac is connected to the Internet via WiFi. The Mini, which does not have wireless, is connected to the Internet via Internet Sharing over an ethernet cable to the Lion iMac.
    Now here's the problem. I can print from the Lion iMac through printer sharing across to the SL iMac. However, I can't figure out how to print from the Mini. It won't find the SL iMac's printer. Enabling printer sharing on the Lion iMac lets the Mini see it as a 'printer,' but it won't print across to the SL iMac.
    So with this setup, is it possible to print to the SL iMac from the wireless-less Mini?
    Just to ward off possible non-workable solutions, rearranging the computers is not feasable right now. It is also not possible to connect the Mini directly to the internet via ethernet. My cable modem is actually in a near-inaccessable part of the house due to that being where the only cable plug is. I have a Time Capsule attached to it, which broadcasts my wireless signal that the WiFi computers can pick up. And no, I can't connect the printer to the Time Capsule—believe me, I tried. I don't want to have to start buying long cables and drilling holes if there's a simpler solution.
    Thanks in advance.

    If I switch to the discussed set up (Airport Extreme N router), will adding an AX in between at 15 feet help bridge the link between the G5's Airport extreme card and the living room's AX?
    Yes. But I still think you should verify if Wi-Fi interference is the cause of your poor signal only 30' away from the AX before going out and purchase anything. Remember, you will tradeoff bandwidth performance for signal strength. With audio, this can be a negative factor.
    If you can get a hold of a laptop, I suggest downloading a copy of iStumbler. Use iStumbler's Inspector feature (select Edit > Inspector from iStumbler's menu) to determine the Signal-to-Noise Ratio (SNR) at different points around your house, by performing a simple RF site survey. Within the Inspector, note the values for "signal" & "noise" at these locations. Start with the laptop near the AX, note the readings, and then, choose the locations between the AX and, finally, where you have the G5.
    SNR is the signal level (in dBm) minus the noise level (in dBm). For example, a signal level of -53dBm measured near an access point and typical noise level of -90dBm yields a SNR of 37dB, a healthy value for wireless LANs.
    The SNR, as measured from the laptop, decreases as the range to the base station increases because of applicable free space loss. Also an increase in RF interference from microwave ovens and cordless phones, which increases the noise level, also decreases SNR.
    SNR Guideline
    o 40dB+ SNR = Excellent signal
    o 25dB to 40dB SNR = Very good signal
    o 15dB to 25dB SNR = Low signal
    o 10dB to 15dB SNR = Very low signal
    o 5dB to 10dB SNR = No signal
    If the SNR is 20dB+ at each of these locations, then you should be getting reasonable performance from your AirPort. If less, either try to locate the source of the Wi-Fi interference or try relocating the base station or the G5 until they are within a 20dB SNR range.

  • Empty property across App Modules

    I created three Application Modules. I'm prompting the user for a username and password. And then populating with:
            ((Hashtable)connEnvironment).put(Configuration.DB_USERNAME_PROPERTY, mUserName);  
            ((Hashtable)connEnvironment).put(Configuration.DB_PASSWORD_PROPERTY, mPassword);
            ((Hashtable)connEnvironment).put(JboContext.SECURITY_PRINCIPAL, mUserName);
            ((Hashtable)connEnvironment).put(JboContext.SECURITY_CREDENTIALS, mPassword);The first AppMod that loads contains these vars, but AppMods 2 & 3 display the messages below. How would I populate this data across Applications Modules.
    [336] PropertyManager.loadProperty(647) Skipping empty Property ApplicationPath from System Default
    [337] PropertyManager.loadProperty(615) BC4J Property AppModuleJndiName='saleorders.model.CateListAppModule' -->(SessionImpl) from Client Environment
    [338] PropertyManager.loadProperty(647) Skipping empty Property java.naming.security.principal from System Default
    [339] PropertyManager.loadProperty(647) Skipping empty Property java.naming.security.credentials from System Default
    [340] PropertyManager.loadProperty(647) Skipping empty Property jbo.user.principal from System Default
    Thanks.

    repost

  • How do you configure the DAM so it can be shared across multiple CQ instances?

    How do you configure the DAM so it can be shared across multiple CQ instances?

    You can use shared datastore http://dev.day.com/content/kb/home/Crx/CrxSystemAdministration/HowToCombineTheDatastoreToP reserveDiskSpace.html multiple CQ instance will use same file system to share asset
    clustering http://dev.day.com/docs/en/crx/current/administering/cluster.html multiple node will share repository.
    But you can not have something like one DAM and then have different CQ instance pointing to it (As not everything goes in to one location in file system)
    Yogesh

  • Will the Application Scope be shared across the cluster in a multi-node OC4

    Hi,
    I have the following requirement:
    Users of the application can only have single (browser) session. When a user who already has a session connects again, he should no longer be allowed to access the older session.
    My proposed implementation is:
    -     After successful login – possibly using a Session Listener - an entry is made in a HashMap UserSessions that lives in the application scope. Key is the username, value is the session id (HttpSession.getId()).
    -     For every request, using a ServletFilter, we check whether the session is still in the UserSessions HashMap for the current user. If a new session has been created for the same user, the session id for that new session is in the UserSessions map and the servletfilter will not find the session. In that case, the filter should invalidate the session and forward to the user to an error page.
    However, the application will run on a multi-node OC4J cluster. I am starting to wonder:
    Will the Application Scope be shared across the cluster in a multi-node OC4J environment?
    I know session state can be shared. But what application state/scope?
    Does anyone know? Do I have to do anything special in the cluster or the application to get this to work?
    Thanks for your help.
    Lucas

    gday Lucas --
    Application scope is not replicated across JVM boundaries with OC4J.
    I'm sure this used to be described in the doc, but I can't find it now from a quick scan.
    If you wanted to use this type of pattern, you could look to use a Coherence cache as distribution mechanism to share objects across multiple JVMs/nodes.
    -steve-

  • After factory reset information shared across devices won't load

    Hello. I recently did a factory reset on my MacBook Air. I backed up my iphoto library and itunes library to external hard drive and was able to load those fine. But I am still having a problem with syncing media and data across devices. Maybe I'm missing something? I set up my icloud; the contacts, address book, etc. seemed to have loaded all the data. BUT: the information that is supposed to load through sharing across my ipad, iphone 5 is not loading. I thought the itunes would load my music just based on the sharing, but it is a good thing I backed it up. Things like ibooks, and the most recent photos I have taken on my iphone are not loaded.
    Please help: I need to know how get all my devices sharing again, and/or pushing media through itunes
    Any tips would be welcome. Thanks.

    Information that is 'shared' via icloud includes calendar events, contacts, todo items, notes, and safari bookmarks. Music that is on an iOS device isn't shared. If it is music you purchased from the Apple iTunes store you can redownload it or it can be moved from the device by using the Transfer Purchases option of the iTunes File menu when your phone is connected to the computer via the cable. iOS apps can also be transferred to the computer this way. New pictures will sync when the phone/iPad is physically connected but I'm not certain how old pictures that exist on the iOS device but not on the computer are handled. You may need to use a third party program to transfer these old pictures - as well as music not purchased from the iTunes store.

  • The guides all say when using the iCloud photos are shared across all devices. Why can't I see my photos from my iPhone on my iPad when it settings on both devices the iCloud for photos is on?

    The guides all say when using the iCloud photos are shared across all devices. Why can't I see my photos from my iPhone on my iPad when it settings on both devices the iCloud for photos is on?

    When you enable Photo Stream on your devices, only new photos you take or import to those devices will be automatically added to your Photo Stream. Existing photos won't.

  • How do I configure my contacts to be shared across multiple emails?

    How do I configure my iPhone6 contacts to be shared across multiple emails accounts?

    By interface I simply mean connected to the contacts.  I have two different gmail accounts, one that uses the apple mail app and the new one that launches from the gmail icon that I downloaded from the app store.  The new one doesn't recognize the contacts.

  • Cluster installation failed:OCR files are not shared across all nodes

    Hi gurus,
    I'm trying to install RAC 10g using vmware following hunter document to install oracle 10g Rac.
    I'm using centos 4.6 ,I'm now stuck on installing cluster which shows error OCR file are not shared across all nodes.
    Please advice

    Review the Release notes, there is a bug and a fix since CRS fails on the last node.
    This bug is for EL 5, but pretty match what I've found on the log files
    I'm also in EL 4.6, x64 in my case.. haven't tried the fix due lack of time.
    Provide log files from CRS_HOME/logs

  • TS3999 i have lost a shared (across several devices) iCloud calendar. How do I get it back?

    I have lost a shared (across several devices) iCloud calendar. How do I get it back?

    Try having the owner resend the invitation for the shared calendar (see http://help.apple.com/icloud/#mm6b1a9cbb), then accept the invitation to add it back.

  • How are "Internet Accounts" shared across Macs?

    I use several Macs (office, home, notebook). I noticed that when I add a new account in "Internet Accounts" on one of the Macs, it may appear on another Mac or may not even if I'm signed in iClouds with the same Apple ID. I wonder how I can control whether a newely added Internet Account is shared across all my Macs.
    Sorry for a trivial question, but I could not find any info on this.

    Hey there zornie,
    It sounds like the features you are describing are part of iCloud Keychain.
    iCloud Keychain can also keep the accounts you use in Mail, Contacts, Calendar, and Messages up to date across all of your Macs. If you're signed in to Facebook, Twitter, Linked In, or any other accounts in Internet Accounts on OS X Mavericks, iCloud can push those accounts to your Macs as well.
    From: iCloud: Frequently asked questions about iCloud Keychain
              http://support.apple.com/kb/HT5813
    If you would like one of your devices to not automatically have accounts setup with iCloud Keychain, you would have to turn off the feature in your settings.
    iCloud: Change iCloud feature settings
    http://support.apple.com/kb/PH2613
    Thank you for using Apple Support Communities.
    Take care,
    SterlingD

  • I have a 'family' yahoo email address which is shared across several phones. How can I set up my phone so if I delete an email which isn't relevant to me it doesn't automatically delete from the other phones?

    I share a yahoo email account with my husband and children. The emails may be for one or more or of us. When an email arrives on my iPhone 5C, if it is not relevant to me (because it's something he is dealing with) then I would like to delete it just from my phone without also deleting from his phone. Or it may be an attachment like a photo which I don't need stored on my phone, but will need to download when I get home and on the PC. He can delete from his Samsung without it deleting on my phone or on the PC, but I've not found a way of setting up my phone so it works the same way. Please can someone tell me which are the best settings to use?

    To set it up as POP you need to delete the account, reboot the phone by holding the HOME and SLEEP buttons at the same time until an Apple logo appears (about 10 seconds), then add it back following these instructions: Forcing creation of a POP or IMAP email account
    I understand that you have used the same account for many years, but the technology is also changing constantly. Years ago the standard was POP (Post Office Protocol), which was designed at a time when it was inconceivable that anyone would access their email from more than one device. When people started using multiple devices, for the most part they wanted to see changes on one device mirrored on another. A new standard, IMAP (Internet Mail Access Protocol) was developed. With iMAP the master copy of all messages resides on a server, and multiple devices are kept in sync with the server. So if you delete a message from one device it is removed from the server, and then removed from all other devices when they next sync. This is the same way Microsoft Exchange works. Other benefits of IMAP include the ability to have multiple mail folders that are kept in sync across devices. In your case you could use this to create a separate folder for each family member, so they could move messages to their own folder and not clutter up the shared Inbox. Most computer mail readers can even automatically sort incoming mail into folders based on the contents of the message.
    IMAP is considered a "higher level" standard than POP. When you create a mail account iOS devices query the server and ask what it supports; if it says it supports IMAP then the account is automatically configured for IMAP. So if you really want POP you must fool it, as described in the link above. In my experience Android devices default to the highest level protocol also, and I suspect newer Blackberries do (although it has been 15 years since I used a BB).

Maybe you are looking for

  • My computer crashed, how do I re-download iTunes music?

    My computer crapped out and I lost everything on my hard drive. I have a whole bunch of music I bought from Itunes. Does anyone know how to go about re-downloading this music. Message was edited by: Host

  • I bought an iPad on ebay that may be stolen

    I bought an ipad on ebay that may be stolen. IT IS A HUDE DILEMMA. I have already talked to a police officer where I live but he will not file a police report. I will explain the situation as best as I can. I bout an ipad on ebay and it said Steve's

  • Workflow Directory does not found in Sybase Directory

    Hello Experts,       I am using workflow for Blackberry Device, and through tutorial i have to copy Few files from "C:\Sybase\UnwiredPlatform\ClienAPI\Workflow\BB" to my Blackberry Simulator Directory, but in My Sybase directory i didn't found that f

  • Problem in executing report for sending mail with form as attachment

    Hi i created a form in SFP and creted a report for sending it as an attachment via email.When it execute the report an error messgae is displyed saying: Unable to load form for language vector E. Please suggest.

  • How to modify parameters for a LOB?

    SQL1: ALTER TABLE "TEST"."T03" MODIFY LOB (COL2) STORE AS SECUREFILE (TABLESPACE "TBS_1" DISABLE STORAGE IN ROW CHUNK 5000 PCTVERSION 22 CACHE READS FILESYSTEM_LIKE_LOGGING STORAGE ( INITIAL 1024 NEXT 1111 PCTINCREASE 12)) SQL2: ALTER TABLE "TEST"."T