Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

9 August 2022

Jakarta persistence 3.1 highlights

  • autocloseable EntityManager and EntityManagerFactory
  • Criteria CASE expression support Expressions as conditions
  • JPQL (and criteria API)
    • CEILING, EXP, FLOOR, LN, POWER, ROUND, SIGN
    • LOCAL DATE/TIME/DATETIME

You can find the specification here.

12 August 2016

Oracle SQLDeveloper connection fails / TNS listener not starting

I had a problem today connecting to my Oracle express database from SQL Developer on Windows 10 with the error: The network adapter could not establish the connection.
Connection did work from SQL*PLUS (Run SQL Command line).
The OracleXETNSListener service was stopped in my services and restarting it did not work.
Turns out the problem was that I changed my computer name yesterday and the service does not use localhost, but the computername.
To solve this I changed the hostname in these files:
%ORACLE_HOME%\app\oracle\product\11.2.0\server\network\ADMIN\listener.ora
%ORACLE_HOME%\app\oracle\product\11.2.0\server\network\ADMIN\tnsnames.ora
Stopped/started the database and everything's fine.

Saw these alternate solutions (did not test):
solution 1: Add the old hostname to C:\Windows\System32\drivers\etc\hosts
solution 2:

SQL> alter system set LOCAL_LISTENER='(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))' scope=both;
SQL> alter system register;


10 May 2016

JPA links (updated)

Reference implementation.

Official documentation:

Others:
Providers often have good JPA documentation as well. Might include extensions (and JDO stuff) though:

Specific topics:
Background:

    18 January 2015

    Glassfish missing DataSource: Table/View XXX does not exist

    I have a little old webapp connecting to a DB using a glassfish ConnectionPool.
    This used to run fine but on a more recent glassfish (4.0) I do net get a good datasource from Glassfish, resulting in a Table/View <name> does not exist error message (the message is a general symptom for a failed DB connection, which can have many other reasons).
    The problem exists if I configure the DataSource in web.xml and also if I inject it using @Resource.
    The solution is to explicitly map the application reference to the JNDI name in WEB-INF/glassfish-web.xml:

    <resource-ref>
        <res-ref-name>jdbc/theDB</res-ref-name>
        <jndi-name>jdbc/theDB</jndi-name>
    </resource-ref>  

    If you don't, Glassfish returns a ConnectionPoolDataSource. Some people corrected this by refering in their web.xml to the ConnectionPoolDataSource, but the solution above will work both for web.xml and Resource injection.

    3 October 2012

    The Object Relational Gap (updated)

    The Object Relational Gap
    transient persistent
    classes tables
    • inheritance
    attributes columns
    objects rows
    • instance attribute
    • implicity ID: reference 
    • field
    • explicit ID: primary key 
    relations relations
    • references
    • unidirectional 
    • ordered (lists) 
    • foreign keys
    • bidirectional 
    behaviour centric data centric
    • navigate to object
    • behaviour based partitioning
    • methods 
    • operate on set
    • relation based partitioning
    • stored procedures 
      • tight behaviour-data coupling
      • triggers, constraints
      • data hiding, encapsulation


      • Permissions