-
Apr 22nd, 2012, 03:14 AM
#1
Generating Unique Exception
I have set up a simple Document called User:
public class User
{
@Id
private String username;
}
I have set up my UserRepository
public interface UserRepository extends MongoRepository<User, String>
{
User findByUsername(String username);
}
I have set up in my applicationContext to generate exceptions
<mongo:mongo host="localhost" port="27017" id="mongo"/>
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.Mongo Template">
<constructor-arg ref="mongo" />
<constructor-arg value="testdb" />
<property name="writeResultChecking" value="EXCEPTION"/>
<property name="writeConcern" value="SAFE"/>
</bean>
Yet, when i insert a second user with same username, while the insert fails, i am not getting an exception. This is using the snapshot build: 1.1.0.BUILD-SNAPSHOT.
Is this a bug, or am i still missing some configuration?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules