Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.owasp.appsensor.storage.jpa2.dao;
 
 
 
This is a repository/dao class for storing/retrieving org.owasp.appsensor.core.Attack objects

Author(s):
John Melton (jtmelton@gmail.com) http://www.jtmelton.com/
public class AttackRepository {
	private EntityManager em;
	public AttackRepository() { }

	public void save(Attack attack) {
		Attack merged = .merge(attack);
		attack.setId(merged.getId());
	}

Search for org.owasp.appsensor.core.Attack by id

Parameters:
id id to search by
Returns:
single org.owasp.appsensor.core.Attack object found by id, or null if not exists
	@Transactional(readOnly = true)
	public Attack find(Integer id) {
		return .createQuery("FROM Attack WHERE id = :id"Attack.class)
				.setParameter("id"id)
	}

	@Transactional(readOnly = true)
	public Collection<AttackfindAll() {
		return .createQuery("FROM Attack"Attack.class).getResultList();
	}
New to GrepCode? Check out our FAQ X