Giter VIP home page Giter VIP logo

guice-repository's People

Contributors

alexey-krylov avatar

Watchers

 avatar

guice-repository's Issues

GenericApplicationContext error

Hello! I have some problem, please help.

In method JpaRepositoryModule.createApplicationContext(...) when you try get 
context.getBean(persistenceUnitName, PlatformTransactionManager.class) you get 
message: "... GenericApplicationContext has has not been refreshed yet".
Maybe there is need to add row
context.refresh();
before getting?
Please advise.



Original issue reported on code.google.com by [email protected] on 14 Jan 2015 at 7:48

Cannot start Guice Injector

When i installed JpaRepository and run it from servlet module

Below is the source code
<
public class JpaGuiceServletConfig extends GuiceServletContextListener {

    @Override
    protected Injector getInjector() {
        return Guice.createInjector(new ServletModule(){
            @Override
             protected void configureServlets() {
                this.install(new JpaRepositoryModule("ptol-persistence-unit") {
                    /* (non-Javadoc)
                     * @see com.google.code.guice.repository.configuration.JpaRepositoryModule#bindRepositories(com.google.code.guice.repository.configuration.RepositoryBinder)
                     */
                    @Override
                    protected void bindRepositories(RepositoryBinder binder) {
                        binder.bind(CategoryRepository.class).to("ptol-persistence-unit");
                    }
                });
                //filter("/*").through(PersistFilter.class);
             }
        });
    }

}
>
i got the error:
<
Jul 10, 2013 4:37:05 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of 
class phattuonline.common.base.JpaGuiceServletConfig
java.lang.NoSuchMethodError: 
org.springframework.transaction.annotation.AnnotationTransactionAttributeSource.
<init>(Lorg/springframework/transaction/annotation/TransactionAnnotationParser;)
V
    at com.google.code.guice.repository.configuration.JpaRepositoryModule.createTransactionAttributeSource(JpaRepositoryModule.java:283)
    at com.google.code.guice.repository.configuration.JpaRepositoryModule.configure(JpaRepositoryModule.java:170)
    at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.AbstractModule.install(AbstractModule.java:118)
    at phattuonline.common.base.JpaGuiceServletConfig$1.configureServlets(JpaGuiceServletConfig.java:19)
    at com.google.inject.servlet.ServletModule.configure(ServletModule.java:53)
    at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.spi.Elements.getElements(Elements.java:101)
    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
    at com.google.inject.Guice.createInjector(Guice.java:95)
    at com.google.inject.Guice.createInjector(Guice.java:72)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at phattuonline.common.base.JpaGuiceServletConfig.getInjector(JpaGuiceServletConfig.java:16)
    at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
>

Do you know why the error happened? Are there something wrong with transaction?

Thanks

Original issue reported on code.google.com by [email protected] on 10 Jul 2013 at 9:40

Can't persist an object -- two EntityManagers instead of one!

Hi --

I've been setting up guice-repository and came across a few issues.

I'm using:
   - guice-repository 1.0
   - guice/guice-persist 3.0
   - spring-data-commons-core-1.4.0.RC1
   - spring-data-jpa-1.2.0.RC1
   - spring 3.2.0.M1


1. In my service method below, the new pojo does not get persisted.
The reason is that there is a EntityManager retrieved by the callout to 
guice-persist's @Transactional.
Then, in this method, spring data jpa's getEntityManager() method returns a 
reference to a different one!

@com.google.inject.persist.Transactional
public PojoAccount saveAccount(PojoAccount account)
{
    EntityManager em = m_accountRepository.getEntityManager();
    System.err.println("save: entityManger=" + em);

    a = m_accountRepository.save(account);
    return a;
}

I tried using spring's 
@org.springframework.transaction.annotation.Transactional annotation,
but this has no effect.  

2. In class JpaRepositoryProvider, the annotation @Nullable can't be resolved.  
I commented it out.

3. In class CustomJpaRepositoryFactory.getTargetRepository(), 
metadata.getDomainClass() didn't resolve.
I changed it to metadata.getDomainType().

Any help you can provide would be most appreciated,

Dan

Original issue reported on code.google.com by [email protected] on 12 Sep 2012 at 5:06

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.