Git Product home page Git Product logo

spring-data-jpa's People

Contributors

centonni avatar chr1st0ph avatar christophstrobl avatar darinmanica avatar diegokrupitza avatar erichaagdev avatar florianluediger avatar gderemetz avatar gregturn avatar heowc avatar jxblum avatar kevin-peters avatar koraktor avatar kriegaex avatar michael-simons avatar mp911de avatar odrotbohm avatar philwebb avatar pranav-hsg avatar pstrnad avatar quaff avatar raniejade avatar reda-alaoui avatar rwinch avatar schauder avatar shin-mallang avatar spring-builds avatar stsypanov avatar sxhinzvc avatar thomasdarimont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-data-jpa's Issues

Support @PersistenceConstructor on entities [DATAJPA-37]

Oliver Drotbohm opened DATAJPA-37 and commented

In Spring Data Commons we have a @PersistenceConstructor annotation that demarcates the constructor to be used when instantiating objects. It would be cool if the query methods and maybe even findOne(…) being able to detect that annotation and force the persistence provider to use that constructor (probably by using the Criteria API)


No further details from DATAJPA-37

Port Hades extension module [DATAJPA-19]

Oliver Drotbohm opened DATAJPA-19 and commented

In Hades there is an extension module that includes some integration into Spring MVC that makes a few things quite easy.

First, it provides a custom WebArgumentResolver to automatically parse pagination information from the HttpServletRequest so that one can simply refer to it from a controller method:

public String showUsers(Model model, Pageable pageable) {
  model.addAttribute("users", repository.readAll(pageable));
  return "users";
}

Second there's a PropertyEditor and Converter implementation that is aware of all the repositories residing in an ApplicationContext so that we can provide a WebArgumentResolver to directly get a loaded entity injected into the controller method instead of injecting the id and the developer needing to manually load the entity:

@RequestMapping("/users/{id}")
public String showUser(@PathVariable("id") User user) {
  ...
}

Questions open

Where to put that code? Introducing a dependency towards the web module of Spring is not a good idea. So we have to come up with either a separate module in the same repo or have a separate repo even


Affects: 1.0 M1

Attachments:

The custom repository implementation should inherit the entity-manager-ref and transaction-manager-ref config [DATAJPA-18]

jokeway opened DATAJPA-18 and commented

The Respository customImplementation is very common of using @PersistenceContext and @Transactional to handle custom method. So the customImplementation should inject the 'right' transactionManager (as same as <jpa:repositories /> config).
Use the default spring processing to create the bean is the simplest way, but also lost configurable.So I think we should 'replace' the customImplementation's PersistenceContext and Transactional by the <jpa:repositories /> config, especially when using the AutomaticJpaRepositoryConfigInformation.


3 votes, 4 watchers

Junit dependency has the compile scope [DATAJPA-33]

Pablo Alcaraz opened DATAJPA-33 and commented

Junit dependency has the compile scope.

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>

It would have to be

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>


Affects: 1.0 M1

transaction-manager-ref namespace attribute not propagated into bean configuration [DATAJPA-15]

Rain Wang opened DATAJPA-15 and commented

My App has a transactionMangername that is not a "transactionManager" name, I had set the the attribute of the entity-manager-factory-ref, but the app still scan the "tranactionManager"


Attachments:

Issue Links:

  • DATACMNS-12 Make usage of transactions optional for repositories
    ("depends on")

Referenced from: commits b884e73

1 votes, 1 watchers

custome repository support in spring-data-jpa - broken or dropped? [DATAJPA-36]

Oruganti Shanker opened DATAJPA-36 and commented

According to the spring-data-jpa documentation, one can create custom repostories using the factory-class attribute and passing it to the repositories tag.
Example 1.16. Using the custom factory with the namespace

<repositories base-package="com.acme.repository" 
  factory-class="com.acme.MyRepositoryFactoryBean" />

However, when I try to do so, the parser gives the exception:

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'factory-class' is not allowed to appear in element 'jpa:repositories'.

How do I add custom repositories?

The xml file has:

<jpa:repositories base-package="com.shutterfly.....repository"
                  factory-class="....jpa.repository.custom.CustomJpaRepositoryFactoryBean" />

Affects: 1.0 M1

Add Sort implementations that use JPA Metamodel API and/or QueryDsl API [DATAJPA-12]

Oliver Drotbohm opened DATAJPA-12 and commented

The Sort implementation in the core handles String properties. As JPA 2.0 provides a meta model to define properties in a type-safe manner we should add a subclass of Sort to rather use these properties. A QueryDsl implementation should be added also


Issue Links:

  • DATACMNS-402 Add support for sorting by a QueryDSL OrderSpecifier

  • DATAJPA-8 Integration of QueryDsl library

Referenced from: commits 5d6e44d, 1d6806b, 3110b4d, 692b238, 8668e01, 730e688

6 votes, 7 watchers

Build with Maven 3 [DATAJPA-26]

Gordon Dickens opened DATAJPA-26 and commented

Unable to build with Maven version 3.0.2. Some, dependencies will not resolve. Possibly updating Maven plugin versions would remedy this issue, as I am typically able to build any Spring 3.0 - 3.1 project with current Maven plugins.


Affects: 1.0 M1

Attachments:

Referenced from: commits 4da059f, 674e12d

Problem with using org.springframework.data.jpa.domain.sample.User with Oracle [DATAJPA-11]

Oruganti Shanker opened DATAJPA-11 and commented

I downlaoded the spring-data-jpa and ran the sample UserRepositoryFinderTests application with both the embedded HSQL DB and against Oracle. The test against Oracle ran into a problem because the class User needed a table named USER, and the generated SQL for inserting into this table was giving errors, because the name USER is apparently reserved, and the SQL statement should qualify the table name with the schema name. It may be a good idea to rename the User class so that the sample works out of the box with Oracle. Everything worked fine when I changed the class name, e.g., when User is renamed to JPAUser


No further details from DATAJPA-11

Cannot create a repository for entity with @IdClass [DATAJPA-50]

GWA opened DATAJPA-50 and commented

When I want to create a JpaRepository with an Entity like this:

@Entity
@IdClass(MyEntityPK)
public class MyEntity{
  @Id private String parent;
  @Id private int order;
  …
}

MyEntityPK is a simple bean with String parent; int order; . Then i get the following error :

java.lang.IllegalStateException: No supertype found
	at org.hibernate.ejb.metamodel.AbstractIdentifiableType.requireSupertype(AbstractIdentifiableType.java:74)
	at org.hibernate.ejb.metamodel.AbstractIdentifiableType.getIdType(AbstractIdentifiableType.java:162)
	at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:65)
	at org.springframework.data.jpa.repository.utils.JpaClassUtils.getMetadata(JpaClassUtils.java:103)

Affects: 1.0 M2

Attachments:

Referenced from: commits 3962f1a

13 votes, 18 watchers

Using named queries fails for methods not returning an entity [DATAJPA-44]

Andres March opened DATAJPA-44 and commented

We are migrating from Hades and were very surprised to find exceptions in the JPA NamedQuery parsing. The queries are defined on the entities. The ones triggering the exceptions do not return entities. I think that this is permitted by the specification and did work fine with Hades and Hibernate. Here is an example:

@NamedQuery(name = "CountryAgreement.getLatestAgreementVersion", query = "select max(version) from CountryAgreement c where c.country.id = ?1 ")

The repository method Long getLatestAgreementVersion(Long countryId); and exception:

Caused by: java.lang.IllegalArgumentException: No property getLatestAgreement found for type class java.lang.Long
at org.springframework.data.repository.query.parser.Property.<init>(Property.java:66)
at org.springframework.data.repository.query.parser.Property.<init>(Property.java:100)
at org.springframework.data.repository.query.parser.Property.create(Property.java:302)
at org.springframework.data.repository.query.parser.Property.create(Property.java:268)
at org.springframework.data.repository.query.parser.Property.from(Property.java:227)
at org.springframework.data.repository.query.parser.Property.from(Property.java:215)
at org.springframework.data.repository.query.parser.Part.<init>(Part.java:48)
at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:242)
at org.springframework.data.repository.query.parser.PartTree.buildTree(PartTree.java:101)
at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:77)
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:51)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:100)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:176)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:73)
at org.springframework.data.repository.support.RepositoryFactorySupport$QueryExecuterMethodInterceptor.<init>(RepositoryFactorySupport.java:259)
at org.springframework.data.repository.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:143)
at org.springframework.data.repository.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:107)
at org.springframework.data.repository.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:36)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 36 more


Affects: 1.0 M2

Attachments:

Referenced from: commits c2b7047

Provide strategy interface to customize the date being set while auditing [DATAJPA-9]

Rain Wang opened DATAJPA-9 and commented

I am using spring-data-jpa in my projects. I can set the auditor to the createdBy and lastModifiedBy by the AuditorAware interface, but I want to set database time to the createdDate and lastModifiedDate. Could you please add an attribute to the jpa namespace element to set the dates, and add a DateAware interface?


Attachments:

Referenced from: commits 9ae8caa, c919e2a

1 votes, 0 watchers

Add possibility to integrate versioning infrastructure like Hibernate Envers [DATAJPA-7]

Oliver Drotbohm opened DATAJPA-7 and commented

The auditing capabilities currently serve rudimentary requirements of tracking who created and modified entities. However there are more sophisticated frameworks like Hibernate Envers out there that transparently create revisions for all entities saved and allows accessing those in direct entity access as well as triggering queries on a particular revision. So a potential support for something like this is two fold. First we have to have an extension of Repository interface with methods like:

T findById(ID id, Object revision);

List<T> findAll(Object revision);

On the other hand the query execution engine could be made aware of the revision a query shall be run against:

List<User> findByUsername(String username, @Revision Object revision);

As Envers is just one potential candidate we'd have to make the actual versioning library pluggable


Issue Links:

  • DATAJPA-6 Deeper integration with envers framework
    ("is duplicated by")

5 votes, 7 watchers

Refactor query method name parsing to use new parsing infrastructure and Criteria API [DATAJPA-4]

Oliver Drotbohm opened DATAJPA-4 and commented

The JPA query method name parsing currently builds a String based query and includes a lot of the actual parsing logic. As this will be moved into the core with DATACMNS-10 we should refactor the JPA based implementation to use this one rather than a string based query


Issue Links:

  • DATACMNS-10 Introduce method name parser that allows building criteria based queries from method names
    ("depends on")

Provide access to EntityManager API for JPA repositories [DATAJPA-22]

Stevo Slavić opened DATAJPA-22 and commented

For some EntityManager methods, like flush, default JpaRepository implementation, SimpleJpaRepository, just delegates to wrapped EntityManager instance. Others like clear are not (easily) accessible (see referenced forum topic for use case details). So either wrap and expose EntityManager API, or provide accessor to EntityManager in JpaRepository interface


Affects: 1.0 M1

Reference URL: http://redmine.synyx.org/boards/2/topics/231

Publish spring-jpa-1.0.xsd [DATAJPA-21]

Stevo Slavić opened DATAJPA-21 and commented

Eclipse can't validate spring context files which reference http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd since it's not available. Would have to manually create XML catalog entry. spring-security-3.1.xsd is already available even though Spring Security 3.1 is in RC status, so it seems to be a common practice to have XSD published even if it might change til final release


Affects: 1.0 M1

Issue Links:

  • DATAJPA-24 Should spring-jpa-1.0.xsd reference spring-repository-1.0.xsd instead of spring-repository.xsd

2 votes, 2 watchers

Question about CustomGenericJpaRepository

Hi,

I'm likely to use spring-data-jpa but :

  1. I don't want to use JPA annotations on my domain classes.
  2. I don't want my domain class to implement "IsNewAware".

One solution would be to provide my own CustomGenericJpaRepository but I have no access to the parent's entityManager in this class.

I can't say for sure but, AFAIK "isNew()" method is used to know if we should invoke a "persist" ou a "merge" in the "SimpleJpaRepository.save" method. I suppose we could invoke a merge in any case and that would work. Can you explain why the "isNew()" method is so important ?

Bests Regards

Support search result classes different from Specification query root [DATAJPA-51]

Stevo Slavić opened DATAJPA-51 and commented

Currently Specification API does not support search to return anything other than instance of query root (or some collection of root) JPA entity as result. But JPA itself supports result to be different class from query root and it typically isn't an entity bean class (see here and here).

Please add support for complex queries with search result classes different from Specification query root


Affects: 1.0 M2

42 votes, 25 watchers

Pagination does not work with eager join fetch of association [DATAJPA-35]

Stevo Slavić opened DATAJPA-35 and commented

Query like "SELECT u FROM User u JOIN FETCH u.roles r" doesn't work if repository/DAO method returns org.springframework.data.domain.Page - library tries to calculate total count with additional query "select count(u) FROM foo.bar.User u JOIN FETCH u.roles r" which throws "org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list"


Affects: 1.0 M1

4 votes, 5 watchers

Support taking @Param name from debug info [DATAJPA-46]

Stevo Slavić opened DATAJPA-46 and commented

Already on many places in Spring like in @MVCs @RequestParam, param name is taken from debug info, so explicitly setting value attribute of annotation is not required. Hopefully same principle can be applied for @Param, to remove need for specifying @Param's value attribute in cases (and IMO that's majority) when method parameter name and @Param name are same


Affects: 1.0 M2

Issue Links:

  • DATACMNS-356 Let Parameters work with Spring 4's DefaultParameterNameDiscoverer if available

ClassCastException on getReturnedDomainClass for parametrized types [DATAJPA-45]

Andres March opened DATAJPA-45 and commented

ClassCastException on getReturnedDomainClass for parametrized types.

The query:

 @NamedQuery(name = "ContentFlag.getNewFlagCountByReasonForTitleId", query = "select new map ( c.reason as reason, count(*) as numFlags ) "
                + "from ContentFlag c where c.content.title.id = ?1"
                + " and (c.dateFlagSet > c.content.statistics.dateFlagCleared or c.content.statistics.dateFlagCleared is null) "
                + "group by c.reason")

The method:

public abstract java.util.List com.qualcomm.qis.plaza.repo.ContentFlagRepository.getNewFlagCountByReasonForTitleId(java.lang.Long)

The actual return type:

java.util.List<java.util.Map<java.lang.String, java.lang.Object>>

The line where the exception is thrown:

return (Class<?>) ((ParameterizedType) type)
                    .getActualTypeArguments()[0];

The exception:

Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
	at org.springframework.data.repository.util.ClassUtils.getReturnedDomainClass(ClassUtils.java:63)
	at org.springframework.data.repository.query.QueryMethod.getDomainClass(QueryMethod.java:107)
	at org.springframework.data.jpa.repository.query.JpaQueryMethod.getNamedQueryName(JpaQueryMethod.java:126)
	at org.springframework.data.jpa.repository.query.NamedQuery.lookupFrom(NamedQuery.java:71)
	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:132)
	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:73)
	at org.springframework.data.repository.support.RepositoryFactorySupport$QueryExecuterMethodInterceptor.<init>(RepositoryFactorySupport.java:259)
	at org.springframework.data.repository.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:143)
	at org.springframework.data.repository.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:107)
	at org.springframework.data.repository.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:36)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
	... 36 more


Referenced from: commits spring-projects/spring-data-commons@680a74c

M2 included some API changes that the spring data show case is incompatible with [DATAJPA-49]

Chris Roberts opened DATAJPA-49 and commented

API changes made in M2 cause a some compile errors in the spring data jpa sample.

https://github.com/SpringSource/spring-data-jpa-examples/tree/master/spring-data-jpa-showcase

including the static create method on org.springframework.data.jpa.repository.support.SimpleJpaRepository

userRepository = new SimpleJpaRepository.create(User.class, em);

Perhaps changed to :
userRepository = new SimpleJpaRepository(JpaClassUtils.getMetadata(User.class,em), em);

and findById usage replaced by findOne


Affects: 1.0 M2

Repository findOne method throws Exception with Oracle [DATAJPA-13]

Oruganti Shanker opened DATAJPA-13 and commented

When I call findOne with a JpaRepository working against an Oracle DB, I get an "result returns more than one elements" exception. Instead of an exception, I would expect the findOne method to return one of the records matching the specification, as Mongo does.

Outline of code:
JpaRepository repository = ....;
Specification spec =...;
return repository.findOne(spec);
Exception:

Exception in thread "main" com.shutterfly.platform.infrastructure.dal.MDBFactoryBean$1: result returns more than one elements
at com.shutterfly.platform.infrastructure.dal.MDBFactoryBean.translateExceptionIfPossible(MDBFactoryBean.java:11)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58)
....


Attachments:

Referenced from: commits d108bc9

Add support for searching by Specification and Sort [DATAJPA-48]

Stevo Slavić opened DATAJPA-48 and commented

JpaSpecificationExecutor public API has support for various combination of Specification, Sort, and Pageable. One is missing tho, findAll(Specification<T>, Sort). private TypedQuery<T> getQuery(Specification<T> spec, Sort sort) in JpaSpecificationExecutor already has everything to support exposing such API.

Attached patch [^DATAJPA-Adds-support-for-finding-by-spec-and-sort.patch] adds List<T> findAll(Specification<T> spec, Sort sort); to JpaSpecificationExecutor interface, appropriate implementation in SimpleJpaRepository and a test case.

Patch also configures project pom to add generated test source directory as maven test source directory using build-helper-maven-plugin. With this and m2eclipse configured to run "process-test-classes" goal on project import or when updating eclipse project configuration, project tests could compile


Affects: 1.0 M2

Reference URL: http://forum.springframework.org/showthread.php?p=356230

Attachments:

Referenced from: commits c4a7114

Extending SimpleJpaRepository (fixing problems in JPA spec)

I'm currently implementing a CascadeBulkDeleteJPARepostory to rectify a problem we are having with bulk deletes not removing @EmbeddedCollections. This is a well known problem (see http://stackoverflow.com/questions/3903202/how-to-do-bulk-delete-in-jpa-when-using-element-collections) and am overwriting the SimpleJPARepository to fix such a problem (temporarily just by performing deleteAll(Collection) at this stage). But I would find it beneficial to have access to the variables set by the constructor (at least in 1.0.0.M2).

Now obviously I currently maintain a reference to the objects in my implementation but providing a:

EntityManger getEntityManager()
and
JpaEntityInformation<T, ID> getEntityMetadata()

in the SimpleJPARepostory would be quite useful for such cases.

Thanks & great work.

Reference documentation shows invalid JPQL in example [DATAJPA-20]

Oliver Drotbohm opened DATAJPA-20 and commented

The keyword reference in the Query creation section of the reference documentation shows an invalid sample query for the OrderBy clause:

... where x.age > ?1 order by x.lastname desc

should be

... where x.age = ?1 order by x.lastname desc

http://static.springsource.org/spring-data/data-jpa/docs/1.0.0.M1/reference/html/#jpa.query-methods.query-creation


Affects: 1.0 M1

Attachments:

Referenced from: commits e5b31d6

Make QueryDslJpaRepository more subclass friendly [DATAJPA-39]

Ralph Schaer opened DATAJPA-39 and commented

I needed a projection method in all my repositories. Therefore I created an interface

@NoRepositoryBean
public interface MyRepository<T, ID extends Serializable> extends JpaRepository<T, ID>, QueryDslPredicateExecutor<T> {

	public List<Object[]> findAll(Predicate predicate, Expression<?> first, Expression<?> second, Expression<?>... rest);
}

and the corresponding implementation.

public class MyRepositoryImpl<T, ID extends Serializable> extends QueryDslJpaRepository<T, ID> implements MyRepository<T, ID> {

...
	@Override
	public List<Object[]> findAll(Predicate predicate, Expression<?> first, Expression<?> second, Expression<?>... rest) {
		return createQuery(predicate).list(first, second, rest);
	}

...
}

Together with a FactoryBean and a Factory everything works fine. The only problem I had was that everything in QueryDslJpaRepository is private. So I had to copy a lot of code from the superclass into my implementation because I wanted to use the createQuery(…) method.

Is it possible to make QueryDslJpaRepository more subclass friendly by makeing the createQuery(…) method protected?

Ralph


Affects: 1.0 M2

Attachments:

Referenced from: commits 483baa4

QueryDslPredicateExecutor more subclass friendly

Hi

I created my own Repository interface
public interface MyRepository<T, ID extends Serializable> extends JpaRepository<T, ID>, QueryDslPredicateExecutor {...}
and the corresponding implementation
public interface MyRepository<T, ID extends Serializable> extends JpaRepository<T, ID>, QueryDslPredicateExecutor {...}

Together with a FactoryBean and a Factory everything works fine. The only problem I had was that everything in QueryDslPredicateExecutor is private. So I had to copy a lot of code from this class into my implementation because I wanted to use the createQuery method. Is it possible to make QueryDslPredicateExecutor more subclass friendly or is this a bad idea?

Ralph

@Modifying clearAutomatically default value is true [DATAJPA-31]

Dragan Gajic opened DATAJPA-31 and commented

The default value of clearAutomatically element of @Modifying is true, which result in clearing persistent context after execution of query. If this modifying query is part of sequence of other update operations, for example when in the service layer we combine calls to several DAOs, clearing persistent context by default can lead to unexpected results. Since the service layer methods are usually bounded by transaction, which end is trigger for synchronization all update operations (merge) before modifying query may be loss because of the cleared persistence context.

I believe this is not uncommon situation, so in that sense maybe it is more appropriate to have this option as false by default.


Affects: 1.0 M1

Referenced from: commits 762e57c

Compatibility issue with Google AppEngine? [DATAJPA-47]

Jon Lorusso opened DATAJPA-47 and commented

When I attempt to load Spring Data JPA on the appengine:

WARNING: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fooRepository': FactoryBean threw exception on object creation; nested exception is java.lang.NoSuchMethodError: javax.persistence.EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;:
java.lang.NoSuchMethodError: javax.persistence.EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;
	at org.springframework.data.jpa.repository.utils.JpaClassUtils.getMetadata(JpaClassUtils.java:97)
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:162)
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:91)
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:72)
	at org.springframework.data.repository.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:132)
	at org.springframework.data.repository.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:107)
	at org.springframework.data.repository.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:36)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$2.run(FactoryBeanRegistrySupport.java:133)

Affects: 1.0 M2

Integration of QueryDsl library [DATAJPA-8]

Oliver Drotbohm opened DATAJPA-8 and commented

The QueryDSL library offers a fluent interface for building type safe (JPA) queries. The API looks a lot smoother than the JPA Criteria API so that an integration would be quite a cool thing. I can imagine collaboration in the following areas:

Offer Specifications based on QueryDSL

We could offer an alternative to the standard JPA Criteria API based Specifications as the implementations should become much nicer with Querydsl. So we could have something like this:

public interface QueryDslSpecificationExecutor<T> {

  T findAll(QueryDslSpecification<T>);

  // further Specification executing methods like in JpaRepository
}

We could create a QueryDsl specific subclass of SimpleJpaRepository and use this subclass in case the entity specific repository interface implements this 'mixin' so to speak.

Provide a simple base class for custom query implementations

To ease building queries with QueryDsl we could provide a base class that gets an EntityManager injected and allows to create queries via a helper method. This class could be used for custom repository implementations then.

Links


Issue Links:

  • DATAJPA-12 Add Sort implementations that use JPA Metamodel API and/or QueryDsl API

  • DATAMONGO-41 Prototype QueryDsl integration for repositories

Referenced from: commits a631572

6 votes, 5 watchers

EntityMetadata implementation should use JPA metamodel instead of manual annotation parsing [DATAJPA-28]

Oliver Drotbohm opened DATAJPA-28 and commented

Currently ReflectiveEntityInformation manually parses Id and EmbeddedId annotations to find the entity's id field or method. Unfortunately this excludes users using XML to map their entities. We should rather use the JPA 2.0 metamodel API to lookup the id fields. To do so we also should create a template method that gets the EntityManager to create an IsNewAware as well. Beyond that we could probably get rid of JpaRepositorySupport entirely


Affects: 1.0 M1

Attachments:

Referenced from: commits d3e5588, e48ec42

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.