Skip to content

Instantly share code, notes, and snippets.

View heltonricardo's full-sized avatar
:bowtie:
:shipit:

Helton Ricardo heltonricardo

:bowtie:
:shipit:
View GitHub Profile
@heltonricardo
heltonricardo / migracao.md
Created May 29, 2023 22:02
⚠️ Migração de Conteúdo

⚠️ Migração de Conteúdo

Estou migrando todo o meu conteúdo do GitHub Gist para meu perfil do Medium.
Acesse aqui

@heltonricardo
heltonricardo / 0 - Java Panache Find Query Generator.md
Last active May 17, 2023 12:35
Java Panache Find Query Generator

Java Panache Find Query Generator

@heltonricardo
heltonricardo / java-hibernate-composite-primary-key.md
Last active October 18, 2022 12:47
Java Hibernate Composite Primary Key
@Entity
@Getter
@Setter
public class Inventory {

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class CompositeId implements Serializable {
@heltonricardo
heltonricardo / list_of_all_hibernate_annotations.md
Created September 5, 2022 12:00
List of all Hibernate annotations

@AccessType The @AccessType annotation is deprecated. You should use either the JPA @Access or the Hibernate native @AttributeAccessor annotation.

@Any The @Any annotation is used to define the any-to-one association, which can point to one of several entity types. Read more about this annotation at @Any mapping official documentation.

@AnyMetaDef The @AnyMetaDef annotation is used to provide metadata about an @Any or @ManyToAny mapping. Read more about this annotation at @Any mapping official documentation.

@heltonricardo
heltonricardo / lombok-tips.md
Last active October 18, 2022 13:12
Lombok - Tips

Generate Constructor with Annotation

Java 7 and before samples:

@AllArgsConstructor(onConstructor = @__(@Annotation1, @Annotation2))

@NoArgsConstructor(onConstructor = @__(@Annotation1, @Annotation2))

@RequiredArgsConstructor(onConstructor = @__(@Annotation1, @Annotation2))

@heltonricardo
heltonricardo / java-to-postgresql-data-types-mapping.md
Created September 1, 2022 14:14
Java to PostgreSQL Data Types Mapping
Java PostgreSQL Size
boolean / Boolean boolean / bool 1 bit
short / Short smallint / int2

smallserial / serial2
2 bytes
int / Integer integer / int / int4

serial / serial4
4 bytes
long / Long bigint / int8

bigserial / serial8
8 bytes
float / Float real / float4 4 bytes
double / Double double precision / float8 8 bytes

quarkus.hibernate-orm.database.generation=

Value Description
create Create the schema and destroy previous data
drop Drop the database
drop-and-create Drop and create the database at startup
none Disable DDL handling
update Update the schema if necessary
validate Validate the schema
@heltonricardo
heltonricardo / java-keywords.md
Last active March 31, 2023 14:25
Java Keywords

Java Keywords

Abstract e Final

Palavra-chave Classe Método Atributo
abstract Não pode ser instanciada - Não possui corpo / implementação
- Somente existe em classes abstratas
-
final Não pode ser herdada / extendida Não pode ser reescrito Não pode ser reatribuído

Interface

Um "contrato" que obriga a classe a ter métodos ou propriedades. A implementação dos métodos fica por conta da classe.

@heltonricardo
heltonricardo / Como adicionar css externo a um projeto Angular.md
Last active November 4, 2021 21:42
Como adicionar css externo a um projeto Angular

Como adicionar css externo a um projeto Angular

  1. Insira o arquivo em qualquer diretório dentro do projeto;
  2. No início do arquivo src/styles.css, adicione o seguinte comando:
@import url('diretorio/do/arquivo.css');

Caso o arquivo faça parte de um pacote do node_modules, como o Boostrap, use ~ antes do nome do pacote:

@import url('~bootstrap/dist/css/bootstrap.min.css');
@heltonricardo
heltonricardo / banco-firebase.md
Last active June 28, 2021 11:25
Como criar um banco de dados com FireBase

Como criar um banco de dados simples com FireBase para simular uma REST API

  1. Acesse o FireBase;
  2. Clique em Ir para Console, no canto superior direito;
  3. Clique em Novo Projeto;
  4. Insira um nome;
  5. Ative ou não o Google Analytics;
  6. Na seção Criação, barra lateral esquerda, selecione Realtime Database;
  7. Selecione Criar banco de dados;
  8. Escolha uma localização;