Skip to content

Instantly share code, notes, and snippets.

View odrotbohm's full-sized avatar
👨‍💻
@ home

Oliver Drotbohm odrotbohm

👨‍💻
@ home
View GitHub Profile
@odrotbohm
odrotbohm / gist:9067129
Created February 18, 2014 08:53
Renaming collections with Spring Data MongoDB
mongoOps.execute("myCollection", new CollectionCallback<Void> {
public Void doInCollection(DBCollection collection) {
collection.rename("myNewCollection");
}
}
@odrotbohm
odrotbohm / exception.txt
Last active August 29, 2015 13:57
DataNucleus test errors
[INFO] --- maven-surefire-plugin:2.12:test (datanucleus-tests) @ spring-data-jpa ---
[INFO] Surefire report directory: /Users/olivergierke/Documents/workspace/spring-data-jpa/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
objc[70822]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
Running org.springframework.data.jpa.repository.DataNucleusNamespaceUserRepositoryTests
2014-03-13 10:09:51,497 ERROR ramework.test.context.TestContextManager: 309 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@5f36ba3] to prepare test instance [org.springframework.data.jpa.repository.DataNucleusNamespaceUserRepositoryTes
List<Object> nested = new ArrayList<Object>();
nested.addAll(someNesteditems);
nested.addAll(someOtherNestedItems);
SampleResource resource = new SampleResource();
resource.nested = new Resources<Object>(nested);
@odrotbohm
odrotbohm / alps-orders.json
Created June 13, 2014 13:04
Sample ALPS document for Spring RESTBucks orders
{
"version" : "1.0",
"descriptors" : [ {
"id" : "order-representation",
"descriptors" : [ {
"name" : "status",
"doc" : {
"value" : "PAYMENT_EXPECTED, PAID, PREPARING, READY, TAKEN",
"format" : "TEXT"
},
package foo;
@NoRepositoryBean
interface InternalRepository<T> extends Repository<T, Long> {
<S extends T> save(S entity);
}
package foo;

Keybase proof

I hereby claim:

  • I am olivergierke on github.
  • I am olivergierke (https://keybase.io/olivergierke) on keybase.
  • I have a public key whose fingerprint is 039A 44B8 6EA1 60D8 C5A7 7234 289F 3090 4F34 EB27

To claim this, I am signing this object:

@odrotbohm
odrotbohm / gist:2f2a070e535b4254cce2
Created April 16, 2015 13:33
hibernate-5-exception.txt
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.443 sec <<< FAILURE!
supportForExpressionBasedQueryMethods(org.springframework.data.jpa.repository.MappedTypeRepositoryIntegrationTests) Time elapsed: 0 sec <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:94)
at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:72)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:212)
at org.springframework.test.context.junit4.SpringJUnit4ClassR
@odrotbohm
odrotbohm / notes.adoc
Last active August 29, 2015 14:19
Talk notes - Microservices @ unKonf 2015
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [infrastructure.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: spring-data-jpa] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-b
@odrotbohm
odrotbohm / there-is-no-spring-vs-javaee.adoc
Last active August 29, 2015 14:23
Translation of a comment I wrote for the German Java Magazin to oppose the impression of a "Spring VS JavaEE" created in another article. https://jaxenter.de/von-einem-spring-versus-javaee-zu-reden-ist-faktisch-eigentlich-falsch-20965

There is no Spring VS. JavaEE

"Why Spring 5 is planning without JavaEE 7" — the opposite of that is true. The framework already supports a lot of specifications of the JavaEE 7 release: Servlet 3.1, JTA 1.2 (@Transactional), JPA 2.1, WebSocket 1.0 etc. are already supported by Spring 4. The JCache support in Spring is so old (introduced in 4.0), many Java developers don’t even realize that the spec hasn’t been included in any official JavaEE release yet.

It’s a matter of fact that for a lot of projects that run on application servers like IBM WebSphere and Oracle Weblogic using Spring as a platform is the only way to use these n