perfectjpattern-users Mailing List for PerfectJPattern
Brought to you by:
bravegag
You can subscribe to this list here.
2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Mansour Al A. <man...@gm...> - 2012-08-12 15:47:08
|
I am trying to setup a project to use Spring and AbstractJpaManagedBaseDao. I am unable to setup the transaction to work properly. I need to have control over the transaction so I am using "RESOURCE_LOCAL". Here's the relevant part of my setup (if something is missing, please let me know): <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> <property name="dataSource" ref="dataSource" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:META-INF/database.properties</value> </list> </property> </bean> <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="org.postgresql.Driver" /> <property name="url" value="jdbc:postgresql://localhost/mydb" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <bean id="vendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="showSql" value="true" /> <property name="generateDdl" value="true" /> <property name="databasePlatform" value="org.hibernate.dialect.PostgreSQLDialect" /> </bean> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="persistenceUnitName" value="altabank" /> <property name="jpaVendorAdapter" ref="vendorAdapter" /> </bean> <bean id="dao" class="com.example.services.CategoryDao" /> @Test public void testUpdate() { ProductCategory category = new ProductCategory(); category.setCategoryName("Weight Loose"); category.setDescription("Products that helps in loosing weight"); // dao.getTransaction().begin(); String id = dao.create(category); // dao.getTransaction().commit(); assertNotNull(id); } In the debug messages, I am getting: DEBUG [main] (StatefulPersistenceContext.java:899) - Initializing non-lazy collections DEBUG [main] (Loader.java:2070) - Done entity load DEBUG [main] (ExtendedEntityManagerCreator.java:404) - No local transaction to join DEBUG [main] (SqlStatementLogger.java:104) - select nextval ('hibernate_sequence') Hibernate: select nextval ('hibernate_sequence') DEBUG [main] (AbstractEntityManagerImpl.java:1131) - Mark transaction for rollback Additionally, when I try to change the transaction to JTA instead of RESOURCE_LOCAL, I don't see any dao executed. Any advice ?? Thank you. |
From: Giovanni A. <bra...@gm...> - 2010-12-17 12:24:33
|
Hello again, Oh I see now what you mean. I am sorry in 1.0.2 there is no way to do that, IQuery is quite limited. If you could fetch and build the snapshot 1.0.3 (trunk) then you can do this is the way you want. In 1.0.3 all improvements related to the Generic DAO implementation (including adding the necessary IQuery features) are stable and fully covered with unit tests. Best regards, Giovanni On Dec 17, 2010, at 3:22 AM, Mansour Al Akeel wrote: > Hello all: > How do I use queires in a DAO that extends AbstractJpaManagedBaseDao ? > > For example, AbstractJpaManagedBaseDao prevents accessing entityManager. > So I can not use queries to select of filter some objects. Here's a > code: > > @Stateless(name = "GeoDao") > public class GeoDaoImpl extends AbstractJpaManagedBaseDao<String, Geo> implements GeoDao { > > public GeoDaoImpl() { > super(Geo.class); > } > > @PersistenceContext(unitName = "myPU") > public void setEntityManager(EntityManager em) { > super.setEntityManager(em); > } > > @Override public Geo getByAbbreviation(String abbreviation) { > IQuery query = getSession().createQuery("select g from Geo g WHERE g.abbreviation= :abbr"); > //HERE I NEED TO SET THE PARAMETERS for abbreviation > List <Geo> res = query.getResultList(); > return res.get(0); > } > } > > > I am using openEJB with openJPA. Can not use spring or hibernate. > Am I missing something ? > > > Thank you in advance > > ------------------------------------------------------------------------------ > Lotusphere 2011 > Register now for Lotusphere 2011 and learn how > to connect the dots, take your collaborative environment > to the next level, and enter the era of Social Business. > http://p.sf.net/sfu/lotusphere-d2d > _______________________________________________ > Perfectjpattern-users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perfectjpattern-users |
From: Giovanni A. <bra...@gm...> - 2010-12-17 12:07:43
|
Hello Mansour Al Akeel, Please find my answers below. On Dec 17, 2010, at 3:22 AM, Mansour Al Akeel wrote: > How do I use queires in a DAO that extends AbstractJpaManagedBaseDao ? > Judging by the code below, in general you are using it correctly. From the Generic DAO documentation page <http://perfectjpattern.sourceforge.net/dp-genericdao.html> you can see that extending JPA has limited capabilities compared to that of e.g. AbstractHibernateManagedGenericDao. See this example <http://perfectjpattern.sourceforge.net/xref/org/perfectjpattern/jee/integration/dao/jpa/MovieGenericDao.html> here your use-case is more elegantly covered by using the findByExample capability. > For example, AbstractJpaManagedBaseDao prevents accessing entityManager. > So I can not use queries to select of filter some objects. Here's a > code: > You can still do: - super.getSession().createQuery(...) or - super.getSession().createNativeQuery(...) these two methods mirror the JPA functionality, so you should be fine. HTH, Best regards, Giovanni > @Stateless(name = "GeoDao") > public class GeoDaoImpl extends AbstractJpaManagedBaseDao<String, Geo> implements GeoDao { > > public GeoDaoImpl() { > super(Geo.class); > } > > @PersistenceContext(unitName = "myPU") > public void setEntityManager(EntityManager em) { > super.setEntityManager(em); > } > > @Override public Geo getByAbbreviation(String abbreviation) { > IQuery query = getSession().createQuery("select g from Geo g WHERE g.abbreviation= :abbr"); > //HERE I NEED TO SET THE PARAMETERS for abbreviation > List <Geo> res = query.getResultList(); > return res.get(0); > } > } > > > I am using openEJB with openJPA. Can not use spring or hibernate. > Am I missing something ? > > > Thank you in advance > > ------------------------------------------------------------------------------ > Lotusphere 2011 > Register now for Lotusphere 2011 and learn how > to connect the dots, take your collaborative environment > to the next level, and enter the era of Social Business. > http://p.sf.net/sfu/lotusphere-d2d > _______________________________________________ > Perfectjpattern-users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perfectjpattern-users |
From: Mansour Al A. <man...@gm...> - 2010-12-17 02:22:44
|
Hello all: How do I use queires in a DAO that extends AbstractJpaManagedBaseDao ? For example, AbstractJpaManagedBaseDao prevents accessing entityManager. So I can not use queries to select of filter some objects. Here's a code: @Stateless(name = "GeoDao") public class GeoDaoImpl extends AbstractJpaManagedBaseDao<String, Geo> implements GeoDao { public GeoDaoImpl() { super(Geo.class); } @PersistenceContext(unitName = "myPU") public void setEntityManager(EntityManager em) { super.setEntityManager(em); } @Override public Geo getByAbbreviation(String abbreviation) { IQuery query = getSession().createQuery("select g from Geo g WHERE g.abbreviation= :abbr"); //HERE I NEED TO SET THE PARAMETERS for abbreviation List <Geo> res = query.getResultList(); return res.get(0); } } I am using openEJB with openJPA. Can not use spring or hibernate. Am I missing something ? Thank you in advance |
From: Giovanni A. <bra...@gm...> - 2010-04-03 17:18:07
|
Hello David, >I enjoyed your clean, clear site and am interested in using your software >but... I can't get it to build. I am looking at the perfectjpattern-api pom >file and seeing that it has perfectjpattern-testcommon as a dependency. The >code base does not seem to include this dependency. It would be great if the >perfectjpattern suite was available directly through a maven repository. > There is a Maven repository already available, please see the details here: http://perfectjpattern.sourceforge.net/maven-dependency.html Note however, that I have to still work on the permissions so that the repo can be browsed from Web Browsers but it will work from Maven just fine. >I don't follow how to build your project. I would appreciate any >information you could provide to get me going on this. > If you are trying to build trunk, try first to follow the instructions from this link: http://perfectjpattern.sourceforge.net/sources.html Otherwise please post what exactly is not working for you so I can try to help you. I often run clean builds of trunk (1.0.3-SNAPSHOT) and builds just fine. Hint: have a look or run the script build.sh Best regards, Giovanni |
From: Giovanni A. <bra...@gm...> - 2010-04-03 17:06:05
|
Hello Niran, I have been told about this issue several times. How did you find out? Maven build? The point is that if you open that URL you will get a 403 error, but that only means the repo is not browseable (I would need to check how to change the permissions) but if you just build from Maven it will work. My point is don't assume is down because you can't browse it ... I would say if you can reach the web site fine then the Maven repo is also fine. I just need to fix the permission to allow browsing from Web Browsers. HTH, Best regards, Giovanni >Hi > >Your maven URL http://perfectjpattern.sourceforge.net/m2repo >is down. > >Thanks, >Niran |
From: Giovanni A. G. <bra...@gm...> - 2010-04-02 10:16:28
|
Hello Niran! I am happy you managed! and I apologize for not responding before I thought I was receiving all emails from the list but I wasn't. We are putting together a new version with many major improvements and a parallel implementation of Generic DAO for EclipseLink so switching from one framework to the other from the code prospective should be transparent. Best regards, Giovanni >Sorry, my mistake. I forgot I can initialize the superclass separately with: >public MovieGenericDao() { > super(Movie.class); >} > >Thanks for providing a great framework :) > >Best regards, >Niran > |
From: Niran A. <ni...@eb...> - 2009-12-17 23:30:23
|
Hi Your maven URL http://perfectjpattern.sourceforge.net/m2repo is down. Thanks, Niran |
From: David S. <ds...@gm...> - 2009-08-23 14:21:22
|
Hi Fellows, I enjoyed your clean, clear site and am interested in using your software but... I can't get it to build. I am looking at the perfectjpattern-api pom file and seeing that it has perfectjpattern-testcommon as a dependency. The code base does not seem to include this dependency. It would be great if the perfectjpattern suite was available directly through a maven repository. I don't follow how to build your project. I would appreciate any information you could provide to get me going on this. Thanks, David |
From: Niran A. <ni...@eb...> - 2009-05-11 21:42:28
|
Sorry, my mistake. I forgot I can initialize the superclass separately with: public MovieGenericDao() { super(Movie.class); } Thanks for providing a great framework :) Best regards, Niran > Hi, > > When I try to extend AbstractHibernateManagedGenericDao such as in the > example: > http://perfectjpattern.sourceforge.net/xref/org/perfectjpattern/jee/integration/dao/jpa/MovieGenericDao.html > > My IDE says there is no default constructor available in > org.perfectjpattern.jee.api.integration.dao.AbstractHibernateManagedGenericDao > for: > AbstractHibernateManagedGenericDao<Long, Movie> > > If I look at the class definition for AbstractHibernateManagedGenericDao: > http://perfectjpattern.sourceforge.net/xref/org/perfectjpattern/jee/integration/dao/AbstractHibernateManagedGenericDao.html > > There is only one constructor: > public AbstractHibernateManagedGenericDao(Class<Element> aPersistentClass) > which doesn't match the code example? Does your above example work? Or am I > missing some other apis? > > Thanks, > Niran > > > ------------------------------------------------------------------------------ > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world - but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodak-com > _______________________________________________ > Perfectjpattern-users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perfectjpattern-users > |
From: Niran A. <ni...@eb...> - 2009-05-11 19:06:30
|
Hi, When I try to extend AbstractHibernateManagedGenericDao such as in the example: http://perfectjpattern.sourceforge.net/xref/org/perfectjpattern/jee/integration/dao/jpa/MovieGenericDao.html My IDE says there is no default constructor available in org.perfectjpattern.jee.api.integration.dao.AbstractHibernateManagedGenericDao for: AbstractHibernateManagedGenericDao<Long, Movie> If I look at the class definition for AbstractHibernateManagedGenericDao: http://perfectjpattern.sourceforge.net/xref/org/perfectjpattern/jee/integration/dao/AbstractHibernateManagedGenericDao.html There is only one constructor: public AbstractHibernateManagedGenericDao(Class<Element> aPersistentClass) which doesn't match the code example? Does your above example work? Or am I missing some other apis? Thanks, Niran |
From: Tejash S. <Tej...@sp...> - 2009-02-25 23:40:43
|
I tried to use the maven repository http://perfectjpattern.sourceforge.net/m2repo but I got a 403. Is there a public version of this maven repository? Thanks, Tejash NOTICE: This e-mail message and any attachments may contain confidential, proprietary, or privileged information. If you are not the intended recipient, please notify us immediately by return e-mail, delete this message, and destroy all physical and electronic copies. Thank you. |