Tabnine Logo
HibernateTemplate.findByNamedParam
Code IndexAdd Tabnine to your IDE (free)

How to use
findByNamedParam
method
in
org.springframework.orm.hibernate5.HibernateTemplate

Best Java code snippets using org.springframework.orm.hibernate5.HibernateTemplate.findByNamedParam (Showing top 5 results out of 315)

origin: spring-projects/spring-framework

@Deprecated
@Override
public List<?> findByNamedParam(String queryString, String paramName, Object value)
    throws DataAccessException {
  return findByNamedParam(queryString, new String[] {paramName}, new Object[] {value});
}
origin: org.springframework/spring-orm

@Deprecated
@Override
public List<?> findByNamedParam(String queryString, String paramName, Object value)
    throws DataAccessException {
  return findByNamedParam(queryString, new String[] {paramName}, new Object[] {value});
}
origin: apache/servicemix-bundles

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByNamedParam(final String queryString, final String[] paramNames, final Object[] values)
    throws DataAccessException {
  if (paramNames.length != values.length) {
    throw new IllegalArgumentException("Length of paramNames array must match length of values array");
  }
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    for (int i = 0; i < values.length; i++) {
      applyNamedParameterToQuery(queryObject, paramNames[i], values[i]);
    }
    return queryObject.list();
  }));
}
origin: spring-projects/spring-ldap

@Test
public void testCreateWithException() {
  OrgPerson person = new OrgPerson();
  person.setId(new Integer(2));
  person.setDescription("some description");
  person.setFullname("Some testperson");
  person.setLastname("testperson");
  person.setCountry("Sweden");
  person.setCompany("company1");
  try {
    dummyDao.createWithException(person);
    fail("DummyException expected");
  }
  catch (DummyException expected) {
    assertThat(true).isTrue();
  }
  log.debug("Verifying result");
  // Verify that no entry was created in ldap or hibernate db
  try {
    ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden");
    fail("NameNotFoundException expected");
  }
  catch (NameNotFoundException expected) {
    assertThat(true).isTrue();
  }
  List result = hibernateTemplate.findByNamedParam("from OrgPerson person where person.lastname = :lastname",
      "lastname", person.getLastname());
  assertThat(result.size() == 0).isTrue();
}
origin: spring-projects/spring-ldap

@Test
public void testCreateWithException() {
  OrgPerson person = new OrgPerson();
  person.setId(new Integer(2));
  person.setDescription("some description");
  person.setFullname("Some testperson");
  person.setLastname("testperson");
  person.setCountry("Sweden");
  person.setCompany("company1");
  try {
    dummyDao.createWithException(person);
    fail("DummyException expected");
  }
  catch (DummyException expected) {
    assertThat(true).isTrue();
  }
  log.debug("Verifying result");
  // Verify that no entry was created in ldap or hibernate db
  try {
    ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden");
    fail("NameNotFoundException expected");
  }
  catch (NameNotFoundException expected) {
    assertThat(true).isTrue();
  }
  List result = hibernateTemplate.findByNamedParam("from OrgPerson person where person.lastname = :lastname",
      "lastname", person.getLastname());
  assertThat(result.size() == 0).isTrue();
}
org.springframework.orm.hibernate5HibernateTemplatefindByNamedParam

Popular methods of HibernateTemplate

  • delete
  • save
  • <init>
    Create a new HibernateTemplate instance.
  • find
  • get
  • load
  • update
  • getSessionFactory
    Return the Hibernate SessionFactory that should be used to create Hibernate Sessions.
  • executeWithNativeSession
    Execute the action specified by the given action object within a native Session. This execute varian
  • merge
  • afterPropertiesSet
  • createSessionProxy
    Create a close-suppressing proxy for the given Hibernate Session. The proxy also prepares returned Q
  • afterPropertiesSet,
  • createSessionProxy,
  • disableFilters,
  • doExecute,
  • enableFilters,
  • findByCriteria,
  • findByNamedQueryAndNamedParam,
  • getFilterNames,
  • isCheckWriteOperations

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • addToBackStack (FragmentTransaction)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now