Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HHH-18766 producer #446

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Expand Up @@ -31,7 +31,39 @@ public void destroy() {
public void hhh123Test() throws Exception {
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
// Do stuff...

/*-HitCount event = new HitCount();

entityManager.persist(event);

Catalogue catalogue = new Catalogue();
entityManager.persist(catalogue);

Map<String, Object> args = new LinkedHashMap<String, Object>();

args.put("newPartnumber", "23456");
args.put("partnumber", "12345");

String query = "update HitCount set partNumber=:newPartnumber where partNumber=:partnumber";
// String query = "update HitCount hc set hc.partNumber=:newPartnumber
// where hc.partNumber=:partnumber";
// String query = "update HitCount hc set hc.partNumber=:newPartnumber
// where fk(o.catalogue)=:partnumber";

Query dbQuery = entityManager.createQuery(query);

for (Map.Entry<String, Object> entry : args.entrySet()) {
try {

dbQuery.setParameter(entry.getKey(), entry.getValue());
} catch (IllegalArgumentException e) {
// ignored
}

}

dbQuery.executeUpdate();*/

entityManager.getTransaction().commit();
entityManager.close();
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.hibernate.pojos;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Catalogue {

private String partNumber = "12345";
private String userName = "testuser";

/**
* Gets the part number.
*
* @return the part number
*/
@Id
public String getPartNumber() {
return partNumber;
}

/**
* Sets the part number.
*
* @param partNumber the new part number
*/
public void setPartNumber(String partNumber) {
this.partNumber = partNumber;
}

/**
* Gets the user name.
*
* @return the user name
*/
public String getUserName() {
return userName;
}

/**
* Sets the user name.
*
* @param userName the new user name
*/
public void setUserName(String userName) {
this.userName = userName;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package org.hibernate.pojos;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
public class HitCount {

private String id = "123456789";
// private String partNumber = "12345";
private String userName = "testUser";

private Catalogue catalogue = null;

/**
* Gets the id.
*
* @return the id
*/
@Id
public String getId() {
return id;
}

/**
* Sets the id.
*
* @param id the new id
*/
public void setId(String id) {
this.id = id;
}

/**
* Gets the part number.
*
* @return the part number
*/
// @Column(insertable = false, updatable = false)
// public String getPartNumber() {
// return partNumber;
// }

/**
* Sets the part number.
*
* @param partNumber the new part number
*/
// public void setPartNumber(String partNumber) {
// this.partNumber = partNumber;
// }

/**
* Gets the user name.
*
* @return the user name
*/
public String getUserName() {
return userName;
}

/**
* Sets the user name.
*
* @param userName the new user name
*/
public void setUserName(String userName) {
this.userName = userName;
}

/**
* Gets the catalogue.
*
* @return the catalogue
*/
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "partNumber")
@NotFound(action = NotFoundAction.IGNORE)
public Catalogue getCatalogue() {
return catalogue;
}

/**
* Sets the catalogue
*
* @param catalogue the new catalogue
*/
public void setCatalogue(Catalogue catalogue) {
this.catalogue = catalogue;
}

}
8 changes: 8 additions & 0 deletions orm/hibernate-orm-6/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@
<version>${version.org.assertj.assertj-core}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.5.0</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
Expand Down
Loading