Git Product home page Git Product logo

Comments (15)

angel96 avatar angel96 commented on July 17, 2024

Anotaciones de Entidades

@entity
@access(AccessType.PROPERTY)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

@access(AccesType.PROPERTY) > Le decimos a spring que vamos a utilizar los getters y setters.

@Inheritance > Herencia
@Inheritance (strategy = InheritanceType.TABLE_PER_CLASS)

@id > Identificador en la BBDD
@GeneratedValue(strategy = GenerationType.TABLE) > Delegamos la estrategia de generar el Id unico a la base de datos.

@Version > Actualizaciones de esa entidad por versión

Cuando redefinimos el equals, el hashcode también.

@embeddable > Clase embebible. Los atributos se van a meter en la tabla.

@ElementCollection > IMPORTANTE ponerlo si hacemos un collection de datatypes

@OneToMany
A B
1 -> 1..*

  • Para cada instancia de B le corresponde una de A

Composicion > Recordar el ejemplo del ordenador (Para existir un objeto ordenador tiene que existir todos sus componentes)

mappedBy > Poner en una de las dos relaciones
Ejemplo: Reviewer (Collection de announcement - OneToMany) y Announcement (El collection de announcement tiene un unico reviewer - ManyToOne)

Unique > @column(unique = true)
Varios uniques > @table(uniqueConstraints = @UniqueConstraint(columnNames = {"databaseColumn1", "databaseColumn2"}))

@TeMPOraL(TemporalType.TIMESTAMP) > Para fechas

  • TIMESTAMP: Me devuelve hora y fecha.
  • DATE: Fecha
  • TIME: Hora

@transient > Atributos derivados que no queremos persistir.

Con funciones de agregacion (count, match...) > groupBy en la query JPQL
Condiciones con funciones de agregacion > having count(r) >= 3

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

FIJAROS QUE LA TABLA DE LA SENTENCIA JPQL ESTA ESCRITA CON EL NOMBRE DE LA CLASE JAVA, NO CON EL NOMBRE Y EL FORMATO QUE SE REGISTRA EN MYSQL.

select a from Administrator a
> ;
1 object selected
Actor [name=Administrator1, middleName=Administrator1Middle, surname=Administrator1Surname, photo=https://www.photo.com,
email=admin<administrator@>, phone=954152635, numberProfiles=2]
domain.DomainEntity::id: int = 44
domain.DomainEntity::version: int = 0
domain.Actor::name: java.lang.String = "Administrator1"
domain.Actor::middleName: java.lang.String = "Administrator1Middle"
domain.Actor::surname: java.lang.String = "Administrator1Surname"
domain.Actor::photo: java.lang.String = "https://www.photo.com"
domain.Actor::email: java.lang.String = "admin<administrator@>"
domain.Actor::phone: java.lang.String = "954152635"
domain.Actor::adress: java.lang.String = "C/Reina Mercedes"
domain.Actor::numberProfiles: java.lang.Integer = 2
domain.Actor::account: security.UserAccount = security.UserAccount{id=23, version=0}
domain.Actor::profiles: java.util.Collection = [domain.Profile{id=38, version=0}, domain.Profile{id=39, version=0}]
domain.Actor::message: java.util.Collection = []
domain.Actor::ban: boolean = false

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

@notblank lo usamos para cadenas.
@NotNull lo utilizamos para comprobar que los tipos no sean nulos.

  • Recordad que el tipo integer primitivo no puede ser nulo

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

Script MySQL

drop database if exists Acme-HandyWork;
create database Acme-HandyWork;
#drop user 'acme-user'@'%';
#drop user 'acme-manager'@'%';
create user 'acme-user'@'%'
identified by 'ACME-Us3r-P@ssw0rd';

create user 'acme-manager'@'%'
identified by 'ACME-M@n@ger-6874';

grant select, insert, update, delete
on Acme-HandyWork.* to 'acme-user'@'%';
grant select, insert, update, delete, create, drop, references, index, alter,
create temporary tables, lock tables, create view, create routine,
alter routine, execute, trigger, show view
on Acme-HandyWork.* to 'acme-manager'@'%';

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

Variables booleanas no pueden comenzar por 'is'. Deben tener otro nombre distinto porque si no el setter no lo coge bien Spring.
imagen

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

El @Autowired se coloca a cada servicio que llamemos
imagen

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

No colocar ningun toString en las entidades. Provoca StackOverFlow a la hora de cargar el PopulateDatabase

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

Si un formulario falla, comprobar que tiene el <form:hidden ... >

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

Usar placeholders

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

Errata en diapositiva
imagen

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

Fechas en Spring

ADVERTENCIA: VER ESTA ISSUE EN MODO EDICION
Paso 1.

<script> $(function() { $("#datepicker-1").datepicker({ appendText : "(yy-mm-dd)", dateFormat : "yy-mm-dd" }); }); </script>

Paso 2. <form:label path="">
<spring:message code="finder.date1" />
</form:label>
<form:input path="" type="text" id="datepicker-1" />

Paso 3.
imagen

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

El atributo del formulario:

modelAttribute = "announcement"

El nombre de la variable que le pasamos al metodo controlador:

@Valid Announcement announcement

Tienen que llamarse igual para que la validación en formulario funcione

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

Enlaces de Interes:

https://stackoverflow.com/questions/5229023/jquery-check-uncheck-all-checkboxes-with-a-button

http://www.javawebtutor.com/articles/jsp/jstl-foreach-tag.php

http://javascript-tutor.net/jstutor/jstutor_lesson28.html

https://stackoverflow.com/questions/35612821/spring-mvc-ajax-post

from design-testing1.

angel96 avatar angel96 commented on July 17, 2024

Pagina util para realizar patterns

https://www.debuggex.com/r/EFJ6hmjEF4B78PcA

from design-testing1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.