Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.quarkus.hibernate.panache.managed;

import java.util.Map;
import java.util.stream.Stream;

import jakarta.json.bind.annotation.JsonbTransient;

import com.fasterxml.jackson.annotation.JsonIgnore;
Expand All @@ -14,9 +11,6 @@ public interface PanacheManagedEntityOperations<Completion, Confirmation> extend
* Persist this entity in the database, if not already persisted. This will set your ID field if it is not already set.
*
* @see #isPersistent()
* @see #persist(Iterable)
* @see #persist(Stream)
* @see #persist(Object, Object...)
*/
public Completion persist();

Expand All @@ -25,19 +19,13 @@ public interface PanacheManagedEntityOperations<Completion, Confirmation> extend
* Then flushes all pending changes to the database.
*
* @see #isPersistent()
* @see #persist(Iterable)
* @see #persist(Stream)
* @see #persist(Object, Object...)
*/
public Completion persistAndFlush();

/**
* Delete this entity from the database, if it is already persisted.
*
* @see #isPersistent()
* @see #delete(String, Object...)
* @see #delete(String, Map)
* @see #deleteAll()
*/
public Completion delete();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.hibernate.panache.managed;

import java.util.Map;
import java.util.stream.Stream;

public interface PanacheManagedRepositoryOperations<Entity, Session, Completion, Confirmation, Id> {
Expand Down Expand Up @@ -42,9 +41,6 @@ public interface PanacheManagedRepositoryOperations<Entity, Session, Completion,
*
* @param entity the entity to delete.
* @see #isPersistent(Object)
* @see #delete(String, Object...)
* @see #delete(String, Map)
* @see #deleteAll()
*/
Completion delete(Entity entity);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.quarkus.hibernate.panache.managed.blocking;

import java.util.Map;
import java.util.stream.Stream;

import jakarta.json.bind.annotation.JsonbTransient;

import com.fasterxml.jackson.annotation.JsonIgnore;
Expand All @@ -17,53 +14,21 @@ private PanacheBlockingOperations operations() {
return PanacheOperations.getBlockingManaged();
}

/**
* Persist this entity in the database, if not already persisted. This will set your ID field if it is not already set.
*
* @see #isPersistent()
* @see #persist(Iterable)
* @see #persist(Stream)
* @see #persist(Object, Object...)
*/
@Override
public default Void persist() {
return operations().persist(this);
}

/**
* Persist this entity in the database, if not already persisted. This will set your ID field if it is not already set.
* Then flushes all pending changes to the database.
*
* @see #isPersistent()
* @see #persist(Iterable)
* @see #persist(Stream)
* @see #persist(Object, Object...)
*/
@Override
public default Void persistAndFlush() {
return operations().persistAndFlush(this);
}

/**
* Delete this entity from the database, if it is already persisted.
*
* @see #isPersistent()
* @see #delete(String, Object...)
* @see #delete(String, Map)
* @see #deleteAll()
*/
@Override
public default Void delete() {
return operations().delete(this);
}

/**
* Returns true if this entity is persistent in the database. If yes, all modifications to
* its persistent fields will be automatically committed to the database at transaction
* commit time.
*
* @return true if this entity is persistent in the database.
*/
@JsonbTransient
// @JsonIgnore is here to avoid serialization of this property with jackson
@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.hibernate.panache.managed.blocking;

import java.util.Map;
import java.util.stream.Stream;

import org.hibernate.Session;
Expand All @@ -23,106 +22,47 @@ private PanacheBlockingOperations operations() {

// Operations

/**
* Returns the {@link Session} for the <Entity> entity class for extra operations (eg. CriteriaQueries)
*
* @return the {@link Session} for the <Entity> entity class
*/
@Override
default Session getSession() {
return operations().getSession(getEntityClass());
}

/**
* Persist the given entity in the database, if not already persisted.
*
* @param entity the entity to persist.
* @see #isPersistent(Object)
* @see #persist(Iterable)
* @see #persist(Stream)
* @see #persist(Object, Object...)
*/
@Override
default Void persist(Entity entity) {
return operations().persist(entity);
}

/**
* Persist the given entity in the database, if not already persisted.
* Then flushes all pending changes to the database.
*
* @param entity the entity to persist.
* @see #isPersistent(Object)
* @see #persist(Iterable)
* @see #persist(Stream)
* @see #persist(Object, Object...)
*/
@Override
default Void persistAndFlush(Entity entity) {
return operations().persistAndFlush(entity);
}

/**
* Delete the given entity from the database, if it is already persisted.
*
* @param entity the entity to delete.
* @see #isPersistent(Object)
* @see #delete(String, Object...)
* @see #delete(String, Map)
* @see #deleteAll()
*/
@Override
default Void delete(Entity entity) {
return operations().delete(entity);
}

/**
* Returns true if the given entity is persistent in the database. If yes, all modifications to
* its persistent fields will be automatically committed to the database at transaction
* commit time.
*
* @param entity the entity to check
* @return true if the entity is persistent in the database.
*/
@Override
default Boolean isPersistent(Entity entity) {
return operations().isPersistent(entity);
}

/**
* Flushes all pending changes to the database using the Session for the <Entity> entity class.
*/
@Override
default Void flush() {
return operations().flush(getEntityClass());
}

/**
* Persist all given entities.
*
* @param entities the entities to persist
* @see #persist(Object)
* @see #persist(Stream)
* @see #persist(Object,Object...)
*/
@Override
default Void persist(Iterable<Entity> entities) {
return operations().persist(entities);
}

/**
* Persist all given entities.
*
* @param entities the entities to persist
* @see #persist(Object)
* @see #persist(Iterable)
* @see #persist(Object,Object...)
*/
@Override
default Void persist(Stream<Entity> entities) {
return operations().persist(entities);
}

/**
* Persist all given entities.
*
* @param entities the entities to persist
* @see #persist(Object)
* @see #persist(Stream)
* @see #persist(Iterable)
*/
@Override
default Void persist(Entity firstEntity, @SuppressWarnings("unchecked") Entity... entities) {
return operations().persist(firstEntity, entities);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.quarkus.hibernate.panache.managed.reactive;

import java.util.Map;
import java.util.stream.Stream;

import jakarta.json.bind.annotation.JsonbTransient;

import com.fasterxml.jackson.annotation.JsonIgnore;
Expand All @@ -18,53 +15,21 @@ private PanacheReactiveOperations operations() {
return PanacheOperations.getReactiveManaged();
}

/**
* Persist this entity in the database, if not already persisted. This will set your ID field if it is not already set.
*
* @see #isPersistent()
* @see #persist(Iterable)
* @see #persist(Stream)
* @see #persist(Object, Object...)
*/
@Override
public default Uni<Void> persist() {
return operations().persist(this);
}

/**
* Persist this entity in the database, if not already persisted. This will set your ID field if it is not already set.
* Then flushes all pending changes to the database.
*
* @see #isPersistent()
* @see #persist(Iterable)
* @see #persist(Stream)
* @see #persist(Object, Object...)
*/
@Override
public default Uni<Void> persistAndFlush() {
return operations().persistAndFlush(this);
}

/**
* Delete this entity from the database, if it is already persisted.
*
* @see #isPersistent()
* @see #delete(String, Object...)
* @see #delete(String, Map)
* @see #deleteAll()
*/
@Override
public default Uni<Void> delete() {
return operations().delete(this);
}

/**
* Returns true if this entity is persistent in the database. If yes, all modifications to
* its persistent fields will be automatically committed to the database at transaction
* commit time.
*
* @return true if this entity is persistent in the database.
*/
@JsonbTransient
// @JsonIgnore is here to avoid serialization of this property with jackson
@JsonIgnore
Expand Down
Loading
Loading