Skip to content

Instantly share code, notes, and snippets.

@schophil
schophil / PrefixFacadeBeanHelper.php
Last active January 11, 2022 12:42
Facade bean helper for RedBeanPHP that allows mapping types with a common prefix to prefix-less models.
<?php
use RedBeanPHP\BeanHelper\SimpleFacadeBeanHelper;
use RedBeanPHP\OODBBean as OODBBean;
/**
* Custom facade bean helper that is aware of a textual prefix in the type names.
* For example mususer, muscontact, musXXX.
*
* @author schophil
@schophil
schophil / jpa-entity.java
Last active February 24, 2022 08:31
JPA entity columns
@Entity(name = "table")
@Table(name = "table")
public class SomeEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private UUID id;
// for postgres "TEXT" type
@Lob
private String document;
@schophil
schophil / JpaStatisticsLogger.java
Created April 18, 2023 10:58
Jpa statistics logger
import lombok.CustomLog;
import org.hibernate.Session;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Component
@CustomLog(topic = "JPA")