get( 'Version' ) );} );/** Preload the homepage LCP image without disabling lazy loading elsewhere. */add_action( 'wp_head', function () { if ( ! is_front_page() || is_paged() ) { return; } $posts = get_posts( array( 'numberposts' => 1, 'post_status' => 'publish', 'post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC', ) ); if ( empty( $posts ) ) { return; } $thumbnail_id = get_post_thumbnail_id( $posts[0]->ID ); $thumbnail_url = $thumbnail_id ? wp_get_attachment_url( $thumbnail_id ) : false; $metadata = $thumbnail_id ? wp_get_attachment_metadata( $thumbnail_id ) : array(); $size_file = ! empty( $metadata['sizes']['pixwell_370x250-2x']['file'] ) ? $metadata['sizes']['pixwell_370x250-2x']['file'] : false; $image_url = $size_file && $thumbnail_url ? trailingslashit( dirname( $thumbnail_url ) ) . $size_file : $thumbnail_url; if ( $image_url ) { printf( '' . "\n", esc_url( $image_url ) ); }}, 1 );/** Give every tag archive a concise description based on its own posts. */add_action( 'wp_head', function () { if ( ! is_tag() ) { return; } $term = get_queried_object(); if ( ! $term instanceof WP_Term ) { return; } $post_ids = get_posts( array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 2, 'fields' => 'ids', 'tag_id' => $term->term_id, 'orderby' => 'date', 'order' => 'DESC', ) ); $titles = array_values( array_filter( array_map( function ( $post_id ) { return wp_html_excerpt( wp_strip_all_tags( get_the_title( $post_id ) ), 42, '…' ); }, $post_ids ) ) ); $context = count( $titles ) > 1 ? sprintf( '“%1$s” ve “%2$s”', $titles[0], $titles[1] ) : ( ! empty( $titles ) ? sprintf( '“%s”', $titles[0] ) : 'ilgili teknik içerikler' ); $templates = array( '%1$s hakkında %2$s başlıklı yazılar ile teknik notları Burak Kutbay’ın kişisel blogunda keşfedin.', '%1$s etiketi altında %2$s ve konuyla bağlantılı rehberler bir arada.', 'Burak Kutbay’ın blogunda %1$s için %2$s başlıklı içerikler, deneyimler ve pratik bilgiler.', '%1$s konusuna dair %2$s; ilgili yazılar ve kaynaklar bu arşivde.', '%1$s ile ilgili %2$s ve diğer güncel teknoloji içeriklerine göz atın.', '%1$s arşivinde %2$s başlıklı içerikler ve konuya yönelik teknik açıklamalar yer alır.', ); $description = sprintf( $templates[ $term->term_id % count( $templates ) ], wp_strip_all_tags( $term->name ), $context ); printf( '' . "\n", esc_attr( wp_html_excerpt( wp_strip_all_tags( $description ), 155, '…' ) ) );}, 0 );/** Build a 140-160 character fallback for posts without a custom Yoast description. */add_filter( 'wpseo_metadesc', function ( $description ) { if ( ! is_singular( 'post' ) ) { return $description; } $post = get_queried_object(); $custom = $post instanceof WP_Post ? get_post_meta( $post->ID, '_yoast_wpseo_metadesc', true ) : ''; if ( $custom ) { return $description; } $source = $post instanceof WP_Post && $post->post_excerpt ? $post->post_excerpt : ( $post instanceof WP_Post ? $post->post_content : '' ); $source = wp_strip_all_tags( strip_shortcodes( $source ) ); $fallback = wp_html_excerpt( $source, 155, '…' ); return $fallback ? $fallback : 'Burak Kutbay’ın kişisel blogunda Java, Spring, yazılım geliştirme ve teknoloji üzerine güncel teknik içerikleri keşfedin.';}, 20 );/** Redirect legacy slugs to their current posts without touching content. */add_action( 'template_redirect', function () { $request_path = parse_url( $_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH ); $request_path = rawurldecode( (string) $request_path ); $legacy_unicode_path = '/cocugunuza-programlama-ogretin-' . "\u{200E}" . 'programlamacocukoyuncagi' . "\u{202C}" . '.html/'; $redirects = array( '/spring-boot-transaction-isolation-propagation-verollback.html/' => '/spring-boot-transaction-isolation-propagation-ve-rollback.html/', '/testcontainers-ile-spring-boot-amp-mongodb-test-islemleri.html/' => '/testcontainers-ile-spring-boot-mongodb-test-islemleri.html/', '/google’dan-freddie-mercurye-ozel-klibi.html/' => '/googledan-freddie-mercurye-ozel-klibi.html/', $legacy_unicode_path => '/cocugunuza-programlama-ogretin-programlamacocukoyuncagi.html/', ); if ( isset( $redirects[ $request_path ] ) ) { wp_safe_redirect( home_url( $redirects[ $request_path ] ), 301 ); exit; }}, 1 ); ERROR: syntax error at or near “user” Hatası ve Çözümü - Burak Kutbay'ın Kişisel Blogu

Arşivler

ERROR: syntax error at or near “user” Hatası ve Çözümü

blank

Java projenizi veritabanı işlemlerinizi JPA kullanarak yapıyorsanız ve veritabanınız PostgreSQL ise bu hatayı alıyorsanız doğru yerdesiniz.

İlk olarak en kökten çözümü söyleyeyim PostgreSQL kullanmazsanız bu sorun çözülür. :p Tabiki öyle bir şey yapmayacağız.

Bu hatanın neden kaynaklandığını söyleyeyim PostgreSQL’in yasaklı kelimeler listesi var ve biz PostgreSQL kullanıyorsak user adında bir tablo oluşturamayız. Güvenlik olarak bu önlem alınmış. Hatta çok güzel olmuş diyebilirim ancak bizim işimize engel oluyor bu durum.

Çözümü oldukça kolay Entitiy tarafında user adını kullanıp veritabanı tarafında Tablo adımızı başka bir ad yaparak bu sorunu çözüyoruz.

Kısaca;

@Entity
@Table(name = "KullanicilarTablosuBu")
public class User {

Yazdığımız anda bu hata ortadan kalkmış olucak.

Keyifli kodlamalar dilerim.